Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit dc32df1

Browse files
authored
Merge pull request #6639 from SimonBrandner/feature/voice-activity
Add active speaker indicators
2 parents 9444995 + d29a18b commit dc32df1

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

res/css/views/voip/_CallView.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ limitations under the License.
7474
> .mx_VideoFeed {
7575
width: 100%;
7676
height: 100%;
77+
border-width: 0 !important; // Override mx_VideoFeed_speaking
7778

7879
&.mx_VideoFeed_voice {
79-
background-color: $inverted-bg-color;
8080
display: flex;
8181
justify-content: center;
8282
align-items: center;

res/css/views/voip/_CallViewSidebar.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ limitations under the License.
3333

3434
> .mx_VideoFeed {
3535
width: 100%;
36+
border-radius: 4px;
3637

3738
&.mx_VideoFeed_voice {
38-
border-radius: 4px;
39-
4039
display: flex;
4140
align-items: center;
4241
justify-content: center;

res/css/views/voip/_VideoFeed.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,23 @@ limitations under the License.
1717
.mx_VideoFeed {
1818
overflow: hidden;
1919
position: relative;
20+
box-sizing: border-box;
21+
border: transparent 2px solid;
22+
display: flex;
2023

2124
&.mx_VideoFeed_voice {
2225
background-color: $inverted-bg-color;
2326
aspect-ratio: 16 / 9;
2427
}
2528

29+
&.mx_VideoFeed_speaking {
30+
border: $accent-color 2px solid;
31+
32+
.mx_VideoFeed_video {
33+
border-radius: 0;
34+
}
35+
}
36+
2637
.mx_VideoFeed_video {
2738
width: 100%;
2839
background-color: transparent;

src/components/views/voip/VideoFeed.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ interface IProps {
4545
interface IState {
4646
audioMuted: boolean;
4747
videoMuted: boolean;
48+
speaking: boolean;
4849
}
4950

5051
@replaceableComponent("views.voip.VideoFeed")
@@ -57,6 +58,7 @@ export default class VideoFeed extends React.PureComponent<IProps, IState> {
5758
this.state = {
5859
audioMuted: this.props.feed.isAudioMuted(),
5960
videoMuted: this.props.feed.isVideoMuted(),
61+
speaking: false,
6062
};
6163
}
6264

@@ -103,11 +105,19 @@ export default class VideoFeed extends React.PureComponent<IProps, IState> {
103105
if (oldFeed) {
104106
this.props.feed.removeListener(CallFeedEvent.NewStream, this.onNewStream);
105107
this.props.feed.removeListener(CallFeedEvent.MuteStateChanged, this.onMuteStateChanged);
108+
if (this.props.feed.purpose === SDPStreamMetadataPurpose.Usermedia) {
109+
this.props.feed.removeListener(CallFeedEvent.Speaking, this.onSpeaking);
110+
this.props.feed.measureVolumeActivity(false);
111+
}
106112
this.stopMedia();
107113
}
108114
if (newFeed) {
109115
this.props.feed.addListener(CallFeedEvent.NewStream, this.onNewStream);
110116
this.props.feed.addListener(CallFeedEvent.MuteStateChanged, this.onMuteStateChanged);
117+
if (this.props.feed.purpose === SDPStreamMetadataPurpose.Usermedia) {
118+
this.props.feed.addListener(CallFeedEvent.Speaking, this.onSpeaking);
119+
this.props.feed.measureVolumeActivity(true);
120+
}
111121
this.playMedia();
112122
}
113123
}
@@ -162,6 +172,10 @@ export default class VideoFeed extends React.PureComponent<IProps, IState> {
162172
});
163173
};
164174

175+
private onSpeaking = (speaking: boolean): void => {
176+
this.setState({ speaking });
177+
};
178+
165179
private onResize = (e) => {
166180
if (this.props.onResize && !this.props.feed.isLocal()) {
167181
this.props.onResize(e);
@@ -173,6 +187,7 @@ export default class VideoFeed extends React.PureComponent<IProps, IState> {
173187

174188
const wrapperClasses = classnames("mx_VideoFeed", {
175189
mx_VideoFeed_voice: this.state.videoMuted,
190+
mx_VideoFeed_speaking: this.state.speaking,
176191
});
177192
const micIconClasses = classnames("mx_VideoFeed_mic", {
178193
mx_VideoFeed_mic_muted: this.state.audioMuted,

0 commit comments

Comments
 (0)