Vimeo autopause option

This commit is contained in:
Sam Potts 2017-11-21 13:33:51 +11:00
parent edfc6cd475
commit f518ec108b
5 changed files with 13 additions and 2 deletions

2
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

2
dist/plyr.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -230,6 +230,7 @@ Option | Type | Default | Description
`iconPrefix` | String | `plyr` | Specify the id prefix for the icons used in the default controls (e.g. "plyr-play" would be "plyr"). This is to prevent clashes if you're using your own SVG sprite but with the default controls. Most people can ignore this option.
`blankUrl` | String | `https://cdn.plyr.io/static/blank.mp4` | Specify a URL or path to a blank video file used to properly cancel network requests.
`autoplay` | Boolean | `false` | Autoplay the media on load. This is generally advised against on UX grounds. It is also disabled by default in some browsers. If the `autoplay` attribute is present on a `<video>` or `<audio>` element, this will be automatically set to true.
`autopause`&sup1; | Boolean | `false` | Only allow one player playing at once.
`seekTime` | Number | `10` | The time, in seconds, to seek when a user hits fast forward or rewind.
`volume` | Number | `1` | A number, between 0 and 1, representing the initial volume of the player.
`muted` | Boolean | `false` | Whether to start playback muted. If the `muted` attribute is present on a `<video>` or `<audio>` element, this will be automatically set to true.
@ -252,6 +253,8 @@ Option | Type | Default | Description
`quality` | Object | `{ default: 'default', options: ['hd2160', 'hd1440', 'hd1080', 'hd720', 'large', 'medium', 'small', 'tiny', 'default'] }` | Currently only supported by YouTube. `default` is the default quality level, determined by YouTube. `options` are the options to display.
`loop` | Object | `{ active: false }` | `active`: Whether to loop the current video. If the `loop` attribute is present on a `<video>` or `<audio>` element, this will be automatically set to true This is an object to support future functionality.
1. Vimeo only
## API
There are methods, setters and getters on a Plyr object.

View File

@ -12,6 +12,9 @@ const defaults = {
// Auto play (if supported)
autoplay: false,
// Only allow one media playing at once (vimeo only)
autopause: false,
// Default time to skip when rewind/fast forward
seekTime: 10,

View File

@ -203,6 +203,11 @@ const vimeo = {
vimeo.setAspectRatio.call(this, ratio);
});
// Set autopause
player.embed.setAutopause(player.config.autopause).then(state => {
player.config.autopause = state;
});
// Get available speeds
if (player.config.controls.includes('settings') && player.config.settings.includes('speed')) {
controls.setSpeedMenu.call(player);