mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Merge pull request #6639 from SimonBrandner/feature/voice-activity
Add active speaker indicators
This commit is contained in:
commit
dc32df1ba5
4 changed files with 28 additions and 3 deletions
|
@ -74,9 +74,9 @@ limitations under the License.
|
||||||
> .mx_VideoFeed {
|
> .mx_VideoFeed {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
border-width: 0 !important; // Override mx_VideoFeed_speaking
|
||||||
|
|
||||||
&.mx_VideoFeed_voice {
|
&.mx_VideoFeed_voice {
|
||||||
background-color: $inverted-bg-color;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -33,10 +33,9 @@ limitations under the License.
|
||||||
|
|
||||||
> .mx_VideoFeed {
|
> .mx_VideoFeed {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&.mx_VideoFeed_voice {
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|
||||||
|
&.mx_VideoFeed_voice {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
@ -17,12 +17,23 @@ limitations under the License.
|
||||||
.mx_VideoFeed {
|
.mx_VideoFeed {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: transparent 2px solid;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
&.mx_VideoFeed_voice {
|
&.mx_VideoFeed_voice {
|
||||||
background-color: $inverted-bg-color;
|
background-color: $inverted-bg-color;
|
||||||
aspect-ratio: 16 / 9;
|
aspect-ratio: 16 / 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.mx_VideoFeed_speaking {
|
||||||
|
border: $accent-color 2px solid;
|
||||||
|
|
||||||
|
.mx_VideoFeed_video {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mx_VideoFeed_video {
|
.mx_VideoFeed_video {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
|
|
@ -45,6 +45,7 @@ interface IProps {
|
||||||
interface IState {
|
interface IState {
|
||||||
audioMuted: boolean;
|
audioMuted: boolean;
|
||||||
videoMuted: boolean;
|
videoMuted: boolean;
|
||||||
|
speaking: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@replaceableComponent("views.voip.VideoFeed")
|
@replaceableComponent("views.voip.VideoFeed")
|
||||||
|
@ -57,6 +58,7 @@ export default class VideoFeed extends React.PureComponent<IProps, IState> {
|
||||||
this.state = {
|
this.state = {
|
||||||
audioMuted: this.props.feed.isAudioMuted(),
|
audioMuted: this.props.feed.isAudioMuted(),
|
||||||
videoMuted: this.props.feed.isVideoMuted(),
|
videoMuted: this.props.feed.isVideoMuted(),
|
||||||
|
speaking: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,11 +105,19 @@ export default class VideoFeed extends React.PureComponent<IProps, IState> {
|
||||||
if (oldFeed) {
|
if (oldFeed) {
|
||||||
this.props.feed.removeListener(CallFeedEvent.NewStream, this.onNewStream);
|
this.props.feed.removeListener(CallFeedEvent.NewStream, this.onNewStream);
|
||||||
this.props.feed.removeListener(CallFeedEvent.MuteStateChanged, this.onMuteStateChanged);
|
this.props.feed.removeListener(CallFeedEvent.MuteStateChanged, this.onMuteStateChanged);
|
||||||
|
if (this.props.feed.purpose === SDPStreamMetadataPurpose.Usermedia) {
|
||||||
|
this.props.feed.removeListener(CallFeedEvent.Speaking, this.onSpeaking);
|
||||||
|
this.props.feed.measureVolumeActivity(false);
|
||||||
|
}
|
||||||
this.stopMedia();
|
this.stopMedia();
|
||||||
}
|
}
|
||||||
if (newFeed) {
|
if (newFeed) {
|
||||||
this.props.feed.addListener(CallFeedEvent.NewStream, this.onNewStream);
|
this.props.feed.addListener(CallFeedEvent.NewStream, this.onNewStream);
|
||||||
this.props.feed.addListener(CallFeedEvent.MuteStateChanged, this.onMuteStateChanged);
|
this.props.feed.addListener(CallFeedEvent.MuteStateChanged, this.onMuteStateChanged);
|
||||||
|
if (this.props.feed.purpose === SDPStreamMetadataPurpose.Usermedia) {
|
||||||
|
this.props.feed.addListener(CallFeedEvent.Speaking, this.onSpeaking);
|
||||||
|
this.props.feed.measureVolumeActivity(true);
|
||||||
|
}
|
||||||
this.playMedia();
|
this.playMedia();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,6 +172,10 @@ export default class VideoFeed extends React.PureComponent<IProps, IState> {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onSpeaking = (speaking: boolean): void => {
|
||||||
|
this.setState({ speaking });
|
||||||
|
};
|
||||||
|
|
||||||
private onResize = (e) => {
|
private onResize = (e) => {
|
||||||
if (this.props.onResize && !this.props.feed.isLocal()) {
|
if (this.props.onResize && !this.props.feed.isLocal()) {
|
||||||
this.props.onResize(e);
|
this.props.onResize(e);
|
||||||
|
@ -173,6 +187,7 @@ export default class VideoFeed extends React.PureComponent<IProps, IState> {
|
||||||
|
|
||||||
const wrapperClasses = classnames("mx_VideoFeed", {
|
const wrapperClasses = classnames("mx_VideoFeed", {
|
||||||
mx_VideoFeed_voice: this.state.videoMuted,
|
mx_VideoFeed_voice: this.state.videoMuted,
|
||||||
|
mx_VideoFeed_speaking: this.state.speaking,
|
||||||
});
|
});
|
||||||
const micIconClasses = classnames("mx_VideoFeed_mic", {
|
const micIconClasses = classnames("mx_VideoFeed_mic", {
|
||||||
mx_VideoFeed_mic_muted: this.state.audioMuted,
|
mx_VideoFeed_mic_muted: this.state.audioMuted,
|
||||||
|
|
Loading…
Reference in a new issue