Skip to content

Commit

Permalink
webkitSupportsPresentationMode("picture-in-picture") is not reliable …
Browse files Browse the repository at this point in the history
…on mobile safari
  • Loading branch information
tmm1 committed May 4, 2017
1 parent 6b4788b commit 4d39d22
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/videojs.pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var PipButton = function PipButton(options) {

if (video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === "function") {
player.on('loadeddata', function () {
if (!player.controlBar.childNameIndex_.hasOwnProperty('PipToggle') && video.webkitSupportsPresentationMode("picture-in-picture")) {
if (!player.controlBar.childNameIndex_.hasOwnProperty('PipToggle') && !window.navigator.userAgent.match(/iPhone/)) {
var PipToggle = this.controlBar.addChild('PipToggle', options);
player.controlBar.el().insertBefore(PipToggle.el(), player.controlBar.fullscreenToggle.el());
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "videojs-pip",
"version": "1.0.2",
"version": "1.0.3",
"description": "video.js plugin to add a PIP button if the browser supports webkitSupportsPresentationMode",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion videojs-pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const PipButton = function(options) {

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

0 comments on commit 4d39d22

Please sign in to comment.