remote-video-playback-manual.html (1699B)
1 <!DOCTYPE html> 2 <html> 3 <title>Test if video is playing on remote device</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/common/media.js"></script> 7 <script> 8 setup({ explicit_timeout: true }); 9 </script> 10 <style> 11 button { 12 padding: 2em; 13 } 14 </style> 15 <body> 16 <div id="pick-device"> 17 <p> 18 Click the button below to prompt for a remote playback device and select 19 one! 20 </p> 21 <p> 22 <button id="prompt-button">Pick device</button> 23 </p> 24 </div> 25 <video src="/media/green-at-15.mp4" id="video"></video> 26 <div id="evaluate" style="display: none"> 27 <p>Does the video play back on the remote device?</p> 28 <p> 29 <button id="yes">Yes</button> 30 </p> 31 <p> 32 <button id="no">No</button> 33 </p> 34 </div> 35 </body> 36 <script> 37 let v = document.getElementById("video"); 38 39 async_test(t => { 40 let button = document.getElementById("prompt-button"); 41 button.onclick = t.step_func(() => { 42 promise_test(() => { 43 return v.remote.prompt().then(() => { 44 v.play(); 45 document.getElementById("evaluate").style.display = "block"; 46 }); 47 }, "Prompt resolves"); 48 }); 49 50 let evaluate = success => 51 assert_true(success, "Video paused and has correct play position."); 52 53 document.getElementById("yes").onclick = t.step_func_done(() => 54 evaluate(true) 55 ); 56 document.getElementById("no").onclick = t.step_func_done(() => 57 evaluate(false) 58 ); 59 }, "Test if video is playing on remote device."); 60 </script> 61 </html>