Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: LayoutTests/media/mediastream-srcobject.html

Issue 545933002: Implement HTMLMediaElement::srcObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed sofs easy comments. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML">
2 <html>
3 <head>
4 <script src=media-file.js></script>
5 <script src=video-test.js></script>
6
7 <script type="text/javascript">
8
9 function playingFromFileOnce()
10 {
11 testExpected(video.currentSrc.length > 0, 1);
12 consoleWrite("EVENT(playingFromFile)<br>");
13 createAndPlayMediaStream();
14 }
15
16 function playingSrcObject()
17 {
18 consoleWrite("EVENT(playingVideo)<br>");
19 video.setAttribute('onplaying', "playingFromFileTwice()");
20 consoleWrite("MediaStream is playing. Set srcObject = null.");
21 video.srcObject=null;
22 }
23
24 function playingFromFileTwice()
25 {
26 consoleWrite("EVENT(playingFromFile)<br>");
27 endTest();
28 }
29
30 function startPlayFile()
31 {
32 findMediaElement();
33 waitForEvent("loadstart");
34 waitForEvent("waiting");
35 waitForEvent("ratechange");
36 waitForEvent("durationchange");
37 waitForEvent("pause");
38 waitForEvent("play");
39 waitForEvent("canplaythrough");
40 waitForEvent('loadeddata');
41
42 consoleWrite("Set src to local file.");
43 video.setAttribute('onplaying', "playingFromFileOnce()");
44
45 var mediaFile;
46 for (var i = 0; i < videoCodecs.length; ++i) {
47 if (video.canPlayType(videoCodecs[i][0])) {
48 mediaFile = "content/test." + videoCodecs[i][1];
49 break;
50 }
51 }
52 video.src = mediaFile;
53 }
54
55 function gotStream(stream)
56 {
57 consoleWrite("Got a MediaStream. Start playing it.");
58 video.setAttribute('onplaying', "playingSrcObject()");
59 video.playbackRate = 2;
60 video.srcObject = stream;
61 testExpected(video.playbackRate, 1);
62 testExpected(video.currentSrc.length, 0);
63 }
64
65 function gotStreamFailed(error)
66 {
67 consoleWrite("Failed to get access to local media. Error code was " + error. code);
68 }
69
70 function createAndPlayMediaStream()
71 {
72 try {
73 consoleWrite("Request access to local media.");
74 navigator.webkitGetUserMedia({video:true}, gotStream, gotStreamFailed);
75 } catch (e) {
76 consoleWrite("getUserMedia error " + "(" + e.name + " / " + e.message + ")");
77 }
78 }
79
80 </script>
81 </head>
82
83 <body onload="startPlayFile()">
84 <p>Test that setting the HTMLMediaElement.srcObject overrides setting the src at tribute and if the srcObect is set to null, media is reloaded from the src attri bute.</p>
85 <video width="320" height="240" autoplay="autoplay"></video>
86 </body>
87 </html>
88
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698