From a3c7e061ea6505a32f130413048392ac3ef2a6c9 Mon Sep 17 00:00:00 2001
From: Robert Swain <rob@matrix.org>
Date: Fri, 28 Apr 2017 15:22:41 +0200
Subject: [PATCH] webrtc/call: Add backward compatibility with
 webkitMediaStream

---
 src/webrtc/call.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/webrtc/call.js b/src/webrtc/call.js
index 9b82ca3f6..71166f652 100644
--- a/src/webrtc/call.js
+++ b/src/webrtc/call.js
@@ -600,7 +600,7 @@ MatrixCall.prototype._maybeGotUserMediaForInvite = function(stream) {
             'OfferToReceiveVideo': self.type === 'video',
         },
     };
-    if (stream instanceof MediaStream) {
+    if (stream instanceof this.webRtc.MediaStream) {
         const videoEl = this.getLocalVideoElement();
 
         if (videoEl && this.type == 'video') {
@@ -661,7 +661,7 @@ MatrixCall.prototype._maybeGotUserMediaForAnswer = function(stream) {
     }
 
     const error = stream;
-    if (stream instanceof MediaStream) {
+    if (stream instanceof this.webRtc.MediaStream) {
         const localVidEl = self.getLocalVideoElement();
 
         if (localVidEl && self.type == 'video') {
@@ -1362,6 +1362,9 @@ module.exports.createNewMatrixCall = function(client, roomId, options) {
     webRtc.RtcIceCandidate = (
         w.RTCIceCandidate || w.webkitRTCIceCandidate || w.mozRTCIceCandidate
     );
+    webRtc.MediaStream = (
+        w.MediaStream || w.webkitMediaStream
+    );
     webRtc.vendor = null;
     if (w.mozRTCPeerConnection) {
         webRtc.vendor = "mozilla";
-- 
GitLab