From 56b15edc58e5c7dc09f765674c659ca77f18c698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 12 Apr 2021 16:19:05 +0200 Subject: [PATCH] Properly handle media MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This might have resulted in the wrong speaker being used or worse Signed-off-by: Šimon Brandner --- src/components/views/voip/VideoFeed.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/views/voip/VideoFeed.tsx b/src/components/views/voip/VideoFeed.tsx index 663c2e4613..43696defb9 100644 --- a/src/components/views/voip/VideoFeed.tsx +++ b/src/components/views/voip/VideoFeed.tsx @@ -63,6 +63,10 @@ export default class VideoFeed extends React.Component { componentDidMount() { this.props.feed.addListener(CallFeedEvent.NewStream, this.onNewStream); + this.playMedia(); + } + + playMedia() { const audioOutput = CallMediaHandler.getAudioOutput(); const currentMedia = this.getCurrentMedia(); @@ -117,14 +121,12 @@ export default class VideoFeed extends React.Component { return this.audio.current || this.video.current; } - onNewStream = (newStream: MediaStream) => { + onNewStream = () => { this.setState({ audioMuted: this.props.feed.isAudioMuted(), videoMuted: this.props.feed.isVideoMuted(), }); - const currentMedia = this.getCurrentMedia(); - currentMedia.srcObject = newStream; - currentMedia.play(); + this.playMedia(); } onResize = (e) => {