| <html> |
| <head> |
| <title>Test fullscreen video going into pip should exit fullscreen</title> |
| <script src="media-file.js"></script> |
| <script src="video-test.js"></script> |
| <script> |
| if (window.internals) |
| window.internals.settings.setAllowsPictureInPictureMediaPlayback(true); |
| |
| function init() |
| { |
| findMediaElement(); |
| video.addEventListener('canplaythrough', oncanplaythrough); |
| video.src = findMediaFile('video', 'content/test'); |
| } |
| |
| function oncanplaythrough() |
| { |
| if (!('webkitSupportsPresentationMode' in video && 'webkitPresentationMode' in video)) { |
| failTest("Presentation mode is not supported in this video element.") |
| return; |
| } |
| |
| consoleWrite("Going into Full Screen"); |
| video.addEventListener('webkitpresentationmodechanged', onfullscreenchange); |
| runWithKeyDown(function(){ video.webkitRequestFullscreen(); }); |
| } |
| |
| function onfullscreenchange() |
| { |
| testExpected("document.webkitCurrentFullScreenElement", video); |
| video.removeEventListener('webkitpresentationmodechanged', onfullscreenchange); |
| |
| consoleWrite("Going into Picture-in-Picture from Full Screen"); |
| video.addEventListener('webkitpresentationmodechanged', onpresentationmodechanged); |
| runWithKeyDown(function() { video.webkitSetPresentationMode("picture-in-picture"); }); |
| } |
| |
| function onpresentationmodechanged() |
| { |
| consoleWrite("Entered Picture-in-Picture from Full Screen"); |
| testExpected("document.webkitCurrentFullScreenElement", null); |
| |
| endTest(); |
| } |
| |
| </script> |
| </head> |
| <body onload="init()"> |
| Tests fullscreen video going into pip should exit fullscreen<br> |
| <video controls></video> |
| </body> |
| </html> |
| |