From 9ac1564951a43a313e49188ee24c90f330215b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Thu, 6 Dec 2018 02:51:49 -0800 Subject: [PATCH] [Picture-in-Picture] Don't require user gesture if capturing user media https://github.com/WICG/picture-in-picture/pull/109 Change-Id: Ib8fab10b713d9ed7df1147045a75abfc974e866b --- ...ediastream.html => mediastream.https.html} | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) rename picture-in-picture/{mediastream.html => mediastream.https.html} (54%) diff --git a/picture-in-picture/mediastream.html b/picture-in-picture/mediastream.https.html similarity index 54% rename from picture-in-picture/mediastream.html rename to picture-in-picture/mediastream.https.html index e187de3d4b6c7d..eee584f78b7b25 100644 --- a/picture-in-picture/mediastream.html +++ b/picture-in-picture/mediastream.https.html @@ -28,5 +28,25 @@ assert_not_equals(pipWindow.width, 0); assert_not_equals(pipWindow.height, 0); }); -}, 'request Picture-in-Picture resolves on user click with Picture-in-Picture window'); +}, 'request Picture-in-Picture with canvas resolves on user click with Picture-in-Picture window'); + +promise_test(async t => { + const video = document.createElement('video'); + video.muted = true; + video.srcObject = await navigator.mediaDevices.getUserMedia({ video: true }); + await video.play(); + return requestPictureInPictureWithTrustedClick(video) + .then(pipWindow => { + assert_not_equals(pipWindow.width, 0); + assert_not_equals(pipWindow.height, 0); + }); +}, 'request Picture-in-Picture with getUserMedia resolves on user click with Picture-in-Picture window'); + +promise_test(async t => { + const video = document.createElement('video'); + video.muted = true; + video.srcObject = await navigator.mediaDevices.getUserMedia({ video: true }); + await video.play(); + return video.requestPictureInPicture(); +}, 'request Picture-in-Picture does not require user gesture if document is capturing user media');