From 27bd3ea83b26b53a6b4a734de9f13cc68ecdba0b Mon Sep 17 00:00:00 2001 From: Herminio Torres Date: Thu, 19 Jul 2018 10:08:32 -0300 Subject: [PATCH] Change how passes the localMediaStream to video [Deprecation] `URL.createObjectURL` with media streams is deprecated and will be removed in M68, around July 2018. Please use `HTMLMediaElement.srcObject` instead. `video.src = window.URL.createObjectURL(localMediaStream);` https://www.chromestatus.com/features/5618491470118912 or https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL --- 19 - Webcam Fun/scripts-FINISHED.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/19 - Webcam Fun/scripts-FINISHED.js b/19 - Webcam Fun/scripts-FINISHED.js index a22085a66a..d86c3b4ace 100755 --- a/19 - Webcam Fun/scripts-FINISHED.js +++ b/19 - Webcam Fun/scripts-FINISHED.js @@ -8,7 +8,11 @@ function getVideo() { navigator.mediaDevices.getUserMedia({ video: true, audio: false }) .then(localMediaStream => { console.log(localMediaStream); - video.src = window.URL.createObjectURL(localMediaStream); + /* + [Deprecation] URL.createObjectURL with media streams is deprecated and will be removed in M68, around July 2018. Please use HTMLMediaElement.srcObject instead. + video.src = window.URL.createObjectURL(localMediaStream); + */ + video.srcObject = localMediaStream; video.play(); }) .catch(err => {