Commit 6997c903 authored by Weiyong Yao's avatar Weiyong Yao Committed by Commit Bot

[desktopCapture Sample] deprecate URL.createObjectURL

URL.createObjectURL with media streams is deprecated and will be removed
in M68, around July 2018. Please use HTMLMediaElement.srcObject instead.

Bug: 826088
Change-Id: Ic1793ce689b0dad667ba80065b13bfafb1b84c79
Reviewed-on: https://chromium-review.googlesource.com/981601Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Weiyong Yao <braveyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546152}
parent 83c3f766
......@@ -65,7 +65,11 @@ function getUserMediaError(error) {
function gotStream(stream) {
console.log('Received local stream', stream);
var video = document.querySelector('video');
try {
video.srcObject = stream;
} catch (error) {
video.src = URL.createObjectURL(stream);
}
stream.onended = function() { console.log('Ended'); };
pc1 = new RTCPeerConnection();
......@@ -107,7 +111,11 @@ function onCreateOfferSuccess(desc) {
function gotRemoteStream(event) {
// Call the polyfill wrapper to attach the media stream to this element.
console.log('hitting this code');
try {
remoteVideo.srcObject = event.stream;
} catch (error) {
remoteVideo.src = URL.createObjectURL(event.stream);
}
}
function onCreateAnswerSuccess(desc) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment