Skip to content

Commit 4d39d22

Browse files
committed
webkitSupportsPresentationMode("picture-in-picture") is not reliable on mobile safari
1 parent 6b4788b commit 4d39d22

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

dist/videojs.pip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var PipButton = function PipButton(options) {
7272

7373
if (video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === "function") {
7474
player.on('loadeddata', function () {
75-
if (!player.controlBar.childNameIndex_.hasOwnProperty('PipToggle') && video.webkitSupportsPresentationMode("picture-in-picture")) {
75+
if (!player.controlBar.childNameIndex_.hasOwnProperty('PipToggle') && !window.navigator.userAgent.match(/iPhone/)) {
7676
var PipToggle = this.controlBar.addChild('PipToggle', options);
7777
player.controlBar.el().insertBefore(PipToggle.el(), player.controlBar.fullscreenToggle.el());
7878
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "videojs-pip",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "video.js plugin to add a PIP button if the browser supports webkitSupportsPresentationMode",
55
"repository": {
66
"type": "git",

videojs-pip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const PipButton = function(options) {
4141

4242
if (video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === "function") {
4343
player.on('loadeddata', function() {
44-
if (!player.controlBar.childNameIndex_.hasOwnProperty('PipToggle') && video.webkitSupportsPresentationMode("picture-in-picture")) {
44+
if (!player.controlBar.childNameIndex_.hasOwnProperty('PipToggle') && !window.navigator.userAgent.match(/iPhone/)) {
4545
var PipToggle = this.controlBar.addChild('PipToggle', options)
4646
player.controlBar.el().insertBefore(PipToggle.el(), player.controlBar.fullscreenToggle.el())
4747
}

0 commit comments

Comments
 (0)