diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java index 275c4ab8e16075..e842403da84caf 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java @@ -50,11 +50,7 @@ public boolean canceled() { + "var video = document.querySelector('video');" + "function successCallback(stream) {" + " window.document.title = 'grant';" - + " if (window.URL) {" - + " video.src = window.URL.createObjectURL(stream);" - + " } else {" - + " video.src = stream;" - + " }" + + " video.srcObject = stream;" + "}" + "function errorCallback(error){" + " window.document.title = 'deny';" diff --git a/chrome/browser/resources/chromeos/user_images_grid.js b/chrome/browser/resources/chromeos/user_images_grid.js index 9ea6d1d75e2fe7..b0002cfa40780d 100644 --- a/chrome/browser/resources/chromeos/user_images_grid.js +++ b/chrome/browser/resources/chromeos/user_images_grid.js @@ -231,9 +231,11 @@ cr.define('options', function() { stopCamera: function() { this.cameraOnline = false; if (this.cameraVideo_) - this.cameraVideo_.src = ''; - if (this.cameraStream_) + this.cameraVideo_.srcObject = null; + if (this.cameraStream_) { this.stopVideoTracks_(this.cameraStream_); + this.cameraStream_ = null; + } // Cancel any pending getUserMedia() checks. this.cameraStartInProgress_ = false; }, @@ -258,7 +260,7 @@ cr.define('options', function() { */ handleCameraAvailable_: function(onAvailable, stream) { if (this.cameraStartInProgress_ && onAvailable()) { - this.cameraVideo_.src = URL.createObjectURL(stream); + this.cameraVideo_.srcObject = stream; this.cameraStream_ = stream; } else { this.stopVideoTracks_(stream); diff --git a/chrome/browser/resources/feedback/js/take_screenshot.js b/chrome/browser/resources/feedback/js/take_screenshot.js index 830fd726004d42..91792317c9edeb 100644 --- a/chrome/browser/resources/feedback/js/take_screenshot.js +++ b/chrome/browser/resources/feedback/js/take_screenshot.js @@ -20,7 +20,7 @@ function takeScreenshot(callback) { video, 0, 0, video.videoWidth, video.videoHeight); video.pause(); - video.src = ''; + video.srcObject = null; screenshotStream.getVideoTracks()[0].stop(); screenshotStream = null; @@ -39,7 +39,7 @@ function takeScreenshot(callback) { function(stream) { if (stream) { screenshotStream = stream; - video.src = window.URL.createObjectURL(screenshotStream); + video.srcObject = screenshotStream; video.play(); } }, diff --git a/chrome/common/extensions/docs/examples/api/tabCapture/receiver.js b/chrome/common/extensions/docs/examples/api/tabCapture/receiver.js index 45234fa0f6daaf..3ea7b400181458 100644 --- a/chrome/common/extensions/docs/examples/api/tabCapture/receiver.js +++ b/chrome/common/extensions/docs/examples/api/tabCapture/receiver.js @@ -12,7 +12,7 @@ function shutdownReceiver() { } var player = document.getElementById('player'); - player.src = ''; + player.srcObject = null; var tracks = window.currentStream.getTracks(); for (var i = 0; i < tracks.length; ++i) { tracks[i].stop(); @@ -32,7 +32,7 @@ window.addEventListener('load', function() { this.play(); }); player.setAttribute('controls', '1'); - player.src = URL.createObjectURL(window.currentStream); + player.srcObject = window.currentStream; // Add onended event listeners. This detects when tab capture was shut down by // closing the tab being captured. diff --git a/chrome/test/data/extensions/api_test/tab_capture/end_to_end.js b/chrome/test/data/extensions/api_test/tab_capture/end_to_end.js index e15e266800595c..283796670d362f 100644 --- a/chrome/test/data/extensions/api_test/tab_capture/end_to_end.js +++ b/chrome/test/data/extensions/api_test/tab_capture/end_to_end.js @@ -102,7 +102,7 @@ function waitForExpectedColors(colorDeviation) { this.video.width = width; this.video.height = height; this.video.addEventListener("error", chrome.test.fail); - this.video.src = URL.createObjectURL(receiveStream); + this.video.srcObject = receiveStream; this.video.play(); this.readbackCanvas = document.createElement("canvas"); @@ -144,7 +144,7 @@ function waitForExpectedColors(colorDeviation) { // Destroy the video, which will disconnect the consumer of the // MediaStream. this.video.removeEventListener("error", chrome.test.fail); - this.video.src = ''; + this.video.srcObject = null; this.video = null; // Wait one second, then execute the second round of testing. This tests diff --git a/chrome/test/data/extensions/api_test/tab_capture/offscreen_test_harness.js b/chrome/test/data/extensions/api_test/tab_capture/offscreen_test_harness.js index 53fa06c0e12814..95af5eef652fea 100644 --- a/chrome/test/data/extensions/api_test/tab_capture/offscreen_test_harness.js +++ b/chrome/test/data/extensions/api_test/tab_capture/offscreen_test_harness.js @@ -132,7 +132,7 @@ function waitForAnExpectedColor( // If not yet done, plug the LocalMediaStream into the video element. if (!this.stream || this.stream != stream) { this.stream = stream; - video.src = URL.createObjectURL(stream); + video.srcObject = stream; video.play(); } diff --git a/chrome/test/data/extensions/api_test/tab_capture/performance.js b/chrome/test/data/extensions/api_test/tab_capture/performance.js index edc9ec15f60957..d869a489ec067b 100644 --- a/chrome/test/data/extensions/api_test/tab_capture/performance.js +++ b/chrome/test/data/extensions/api_test/tab_capture/performance.js @@ -44,7 +44,7 @@ function connectToVideoAndRunTest(stream) { var start_time = new Date().getTime(); // Play the LocalMediaStream in the video element. - video.src = URL.createObjectURL(stream); + video.srcObject = stream; video.play(); var frame = 0; diff --git a/chrome/test/data/webrtc/webrtc-simulcast.html b/chrome/test/data/webrtc/webrtc-simulcast.html index 2777331dfc18ff..f37ffe5111c392 100644 --- a/chrome/test/data/webrtc/webrtc-simulcast.html +++ b/chrome/test/data/webrtc/webrtc-simulcast.html @@ -158,7 +158,7 @@ function gotStream(stream) { trace('Received local stream'); - localVideo.src = webkitURL.createObjectURL(stream); + localVideo.srcObject = stream; localStream = stream; pcClient.addStream(localStream); renegotiateClient(); @@ -217,7 +217,7 @@ // html, otherwise we can't detect video in it. throw 'Received video with unexpected id ' + e.stream.id; } - remoteVideo.src = webkitURL.createObjectURL(e.stream); + remoteVideo.srcObject = e.stream; } function onClientIceCandidate(event) { diff --git a/content/test/data/media/canvas_capture_color.html b/content/test/data/media/canvas_capture_color.html index 2e01262147dfda..34900c9ba46624 100644 --- a/content/test/data/media/canvas_capture_color.html +++ b/content/test/data/media/canvas_capture_color.html @@ -99,7 +99,7 @@ var canvas = document.getElementById('canvas-' + contextType); var video = document.getElementById('canvas-' + contextType + '-local-view'); var stream = canvas.captureStream(); - video.src = URL.createObjectURL(stream); + video.srcObject = stream; video.load(); } diff --git a/content/test/data/media/getusermedia-depth-capture.html b/content/test/data/media/getusermedia-depth-capture.html index ccc9750b382967..e1dabf181c0341 100644 --- a/content/test/data/media/getusermedia-depth-capture.html +++ b/content/test/data/media/getusermedia-depth-capture.html @@ -210,8 +210,7 @@ } function attachMediaStream(stream, videoElement) { - var localStreamUrl = URL.createObjectURL(stream); - $(videoElement).src = localStreamUrl; + $(videoElement).srcObject = stream; } function detectVideoInLocalView1(stream) { diff --git a/content/test/data/media/getusermedia-real-webcam.html b/content/test/data/media/getusermedia-real-webcam.html index a2c942eb6aab23..ed48d439fbcd66 100644 --- a/content/test/data/media/getusermedia-real-webcam.html +++ b/content/test/data/media/getusermedia-real-webcam.html @@ -18,7 +18,7 @@ function gotStreamCallback(stream) { var localView = $('local-view'); - localView.src = URL.createObjectURL(stream); + localView.srcObject = stream; detectVideoPlaying('local-view').then(() => { sendValueToTest(localView.videoWidth + 'x' + localView.videoHeight); }); diff --git a/content/test/data/media/mediarecorder_test.html b/content/test/data/media/mediarecorder_test.html index bdfb8d1d982caa..3b7e22c6c4bacd 100644 --- a/content/test/data/media/mediarecorder_test.html +++ b/content/test/data/media/mediarecorder_test.html @@ -65,8 +65,7 @@ } }; remotePeerConnection.onaddstream = function(event) { - document.getElementById('remoteVideo').src = URL.createObjectURL( - event.stream); + document.getElementById('remoteVideo').srcObject = event.stream; resolve(event.stream); }; @@ -78,14 +77,13 @@ createAnswer(description); }, function(error) { failTest(error.toString()); }); - document.getElementById('video').src = URL.createObjectURL( - localStream); + document.getElementById('video').srcObject = localStream; }); } function createAndStartMediaRecorder(stream, mimeType, slice) { return new Promise(function(resolve, reject) { - document.getElementById('video').src = URL.createObjectURL(stream); + document.getElementById('video').srcObject = stream; var recorder = new MediaRecorder(stream, {'mimeType' : mimeType}); console.log('Recorder object created, mimeType = ' + mimeType); if (slice != undefined) { diff --git a/content/test/data/media/peerconnection-call-audio.html b/content/test/data/media/peerconnection-call-audio.html index 491e270f6fb8b7..d6ac04ab65bfea 100644 --- a/content/test/data/media/peerconnection-call-audio.html +++ b/content/test/data/media/peerconnection-call-audio.html @@ -167,8 +167,7 @@ } function displayAndRemember(localStream) { - var localStreamUrl = URL.createObjectURL(localStream); - $('local-view').src = localStreamUrl; + $('local-view').srcObject = localStream; gLocalStream = localStream; } @@ -195,9 +194,8 @@ function onRemoteStream(e, target) { console.log("Receiving remote stream..."); gRemoteStreams[target] = e.stream; - var remoteStreamUrl = URL.createObjectURL(e.stream); var remoteVideo = $(target); - remoteVideo.src = remoteStreamUrl; + remoteVideo.srcObject = e.stream; } diff --git a/content/test/data/media/peerconnection-call-data.html b/content/test/data/media/peerconnection-call-data.html index 048d3bfab7883f..baca0c1d81d338 100644 --- a/content/test/data/media/peerconnection-call-data.html +++ b/content/test/data/media/peerconnection-call-data.html @@ -248,8 +248,7 @@ } function displayAndRemember(localStream) { - var localStreamUrl = URL.createObjectURL(localStream); - $('local-view').src = localStreamUrl; + $('local-view').srcObject = localStream; gLocalStream = localStream; } @@ -261,9 +260,8 @@ function onRemoteStream(e, target) { console.log("Receiving remote stream..."); gRemoteStreams[target] = e.stream; - var remoteStreamUrl = URL.createObjectURL(e.stream); var remoteVideo = $(target); - remoteVideo.src = remoteStreamUrl; + remoteVideo.srcObject = e.stream; } function connectOnIceCandidate(caller, callee) { diff --git a/content/test/data/media/peerconnection-call.html b/content/test/data/media/peerconnection-call.html index 243a54d235a115..97e6d611cb54b4 100644 --- a/content/test/data/media/peerconnection-call.html +++ b/content/test/data/media/peerconnection-call.html @@ -193,7 +193,7 @@ var videoElement = document.createElement('video'); // No crash for this operation. - videoElement.src = URL.createObjectURL(newStream); + videoElement.srcObject = newStream; detectVideoPlaying('remote-view-2') .then(reportTestSuccess); }) @@ -516,8 +516,7 @@ } function displayAndRemember(localStream) { - var localStreamUrl = URL.createObjectURL(localStream); - $('local-view').src = localStreamUrl; + $('local-view').srcObject = localStream; gLocalStream = localStream; } @@ -655,9 +654,8 @@ e.stream.id + ' was received.'); } gRemoteStreams[target] = e.stream; - var remoteStreamUrl = URL.createObjectURL(e.stream); var remoteVideo = $(target); - remoteVideo.src = remoteStreamUrl; + remoteVideo.srcObject = e.stream; } // Check that applyConstraints() fails on remote tracks because there is diff --git a/content/test/data/media/video_capture_test.html b/content/test/data/media/video_capture_test.html index d20d8311f5cc6c..05c8640ce64a0c 100644 --- a/content/test/data/media/video_capture_test.html +++ b/content/test/data/media/video_capture_test.html @@ -23,7 +23,7 @@ function gotStreamCallback(stream) { var localView = $('local-view'); - localView.src = URL.createObjectURL(stream); + localView.srcObject = stream; var videoTracks = stream.getVideoTracks(); if (videoTracks.length == 0) { diff --git a/extensions/test/data/app_view/apitest/media_request/guest.html b/extensions/test/data/app_view/apitest/media_request/guest.html index 9be81cf0b6f28a..787f4c89f0995e 100644 --- a/extensions/test/data/app_view/apitest/media_request/guest.html +++ b/extensions/test/data/app_view/apitest/media_request/guest.html @@ -14,7 +14,7 @@ navigator.webkitGetUserMedia( { video: true, audio: true }, function(stream) { - video.src = window.URL.createObjectURL(stream); + video.srcObject = stream; }, function(err) { window.console.log(err); } ); } diff --git a/native_client_sdk/src/examples/api/video_encode/example.js b/native_client_sdk/src/examples/api/video_encode/example.js index 9cf5e626a0183f..581d5bed7965ff 100644 --- a/native_client_sdk/src/examples/api/video_encode/example.js +++ b/native_client_sdk/src/examples/api/video_encode/example.js @@ -13,7 +13,7 @@ function $(id) { function success(stream) { track = stream.getVideoTracks()[0]; var video = $('video') - video.src = URL.createObjectURL(stream); + video.srcObject = stream; video.track = track; video.play(); diff --git a/ppapi/examples/video_effects/video_effects.html b/ppapi/examples/video_effects/video_effects.html index 54697534ca2e5a..a1128c0a6926a9 100644 --- a/ppapi/examples/video_effects/video_effects.html +++ b/ppapi/examples/video_effects/video_effects.html @@ -51,7 +51,7 @@