Skip to content

Commit

Permalink
⬆️ Bump plyr from 3.4.5 to 3.4.6 (#16)
Browse files Browse the repository at this point in the history
* ⬆️ Bump plyr from 3.4.5 to 3.4.6

Bumps [plyr](https://github.com/sampotts/plyr) from 3.4.5 to 3.4.6.
- [Release notes](https://github.com/sampotts/plyr/releases)
- [Changelog](https://github.com/sampotts/plyr/blob/master/changelog.md)
- [Commits](sampotts/plyr@v3.4.5...v3.4.6)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* ⬆️ Update Plyr assets
  • Loading branch information
dependabot[bot] authored and jonnitto committed Oct 25, 2018
1 parent 7eb2c62 commit d82bfa5
Show file tree
Hide file tree
Showing 15 changed files with 194 additions and 59 deletions.
10 changes: 10 additions & 0 deletions Resources/Private/Assets/Scripts/config/states.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ==========================================================================
// Plyr states
// ==========================================================================

export const pip = {
active: 'picture-in-picture',
inactive: 'inline',
};

export default { pip };
3 changes: 0 additions & 3 deletions Resources/Private/Assets/Scripts/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ const html5 = {
triggerEvent.call(player, player.media, 'qualitychange', false, {
quality: input,
});

// Save to storage
player.storage.set({ quality: input });
},
});
},
Expand Down
42 changes: 33 additions & 9 deletions Resources/Private/Assets/Scripts/plyr.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// ==========================================================================
// Plyr
// plyr.js v3.4.5
// plyr.js v3.4.6
// https://github.com/sampotts/plyr
// License: The MIT License (MIT)
// ==========================================================================

import captions from './captions';
import defaults from './config/defaults';
import { pip } from './config/states';
import { getProviderByUrl, providers, types } from './config/types';
import Console from './console';
import controls from './controls';
Expand Down Expand Up @@ -695,17 +696,27 @@ class Plyr {
config.default,
].find(is.number);

let updateStorage = true;

if (!options.includes(quality)) {
const value = closest(options, quality);
this.debug.warn(`Unsupported quality option: ${quality}, using ${value} instead`);
quality = value;

// Don't update storage if quality is not supported
updateStorage = false;
}

// Update config
config.selected = quality;

// Set quality
this.media.quality = quality;

// Save to storage
if (updateStorage) {
this.storage.set({ quality });
}
}

/**
Expand Down Expand Up @@ -886,21 +897,28 @@ class Plyr {
* TODO: detect outside changes
*/
set pip(input) {
const states = {
pip: 'picture-in-picture',
inline: 'inline',
};

// Bail if no support
if (!support.pip) {
return;
}

// Toggle based on current state if not passed
const toggle = is.boolean(input) ? input : this.pip === states.inline;
const toggle = is.boolean(input) ? input : !this.pip;

// Toggle based on current state
this.media.webkitSetPresentationMode(toggle ? states.pip : states.inline);
// Safari
if (is.function(this.media.webkitSetPresentationMode)) {
this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive);
}

// Chrome
if (is.function(this.media.requestPictureInPicture)) {
if (!this.pip && toggle) {
this.media.requestPictureInPicture();
} else if (this.pip && !toggle) {
document.exitPictureInPicture();
}
}
}

/**
Expand All @@ -911,7 +929,13 @@ class Plyr {
return null;
}

return this.media.webkitPresentationMode;
// Safari
if (!is.empty(this.media.webkitPresentationMode)) {
return this.media.webkitPresentationMode === pip.active;
}

// Chrome
return this.media === document.pictureInPictureElement;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Assets/Scripts/plyr.polyfilled.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==========================================================================
// Plyr Polyfilled Build
// plyr.js v3.4.5
// plyr.js v3.4.6
// https://github.com/sampotts/plyr
// License: The MIT License (MIT)
// ==========================================================================
Expand Down
22 changes: 20 additions & 2 deletions Resources/Private/Assets/Scripts/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
77 changes: 60 additions & 17 deletions Resources/Public/plyr.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Resources/Public/plyr.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Public/plyr.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Public/plyr.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit d82bfa5

Please sign in to comment.