From fe26d383f101062745ef1397832959df8911161b Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Thu, 25 Oct 2018 09:17:15 +1100 Subject: Added support for picture-in-picture in Chrome --- src/js/support.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/js/support.js') diff --git a/src/js/support.js b/src/js/support.js index 6395293f..59f27c3b 100644 --- a/src/js/support.js +++ b/src/js/support.js @@ -36,8 +36,26 @@ const support = { }, // Picture-in-picture support - // Safari only currently - pip: (() => !browser.isIPhone && is.function(createElement('video').webkitSetPresentationMode))(), + // Safari & Chrome only currently + pip: (() => { + if (browser.isIPhone) { + return false; + } + + // Safari + // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls + if (is.function(createElement('video').webkitSetPresentationMode)) { + return true; + } + + // Chrome + // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture + if (document.pictureInPictureEnabled && !createElement('video').disablePictureInPicture) { + return true; + } + + return false; + })(), // Airplay support // Safari only currently -- cgit v1.2.3