Media paused state for embeds

This commit is contained in:
Sam Potts 2016-01-11 08:52:04 +11:00
parent 7d077d543b
commit 18b2d81985
2 changed files with 25 additions and 7 deletions

2
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1104,9 +1104,18 @@
var instance = event.target; var instance = event.target;
// Create a faux HTML5 API using the YouTube API // Create a faux HTML5 API using the YouTube API
plyr.media.play = function() { instance.playVideo(); }; plyr.media.play = function() {
plyr.media.pause = function() { instance.pauseVideo(); }; instance.playVideo();
plyr.media.stop = function() { instance.stopVideo(); }; plyr.media.paused = false;
};
plyr.media.pause = function() {
instance.pauseVideo();
plyr.media.paused = true;
};
plyr.media.stop = function() {
instance.stopVideo();
plyr.media.paused = true;
};
plyr.media.duration = instance.getDuration(); plyr.media.duration = instance.getDuration();
plyr.media.paused = !config.autoplay; plyr.media.paused = !config.autoplay;
plyr.media.currentTime = instance.getCurrentTime(); plyr.media.currentTime = instance.getCurrentTime();
@ -1193,9 +1202,18 @@
plyr.embed.addEvent('ready', function() { plyr.embed.addEvent('ready', function() {
// Create a faux HTML5 API using the Vimeo API // Create a faux HTML5 API using the Vimeo API
plyr.media.play = function() { plyr.embed.api('play'); }; plyr.media.play = function() {
plyr.media.pause = function() { plyr.embed.api('pause'); }; plyr.embed.api('play');
plyr.media.stop = function() { plyr.embed.api('stop') }; plyr.media.paused = false;
};
plyr.media.pause = function() {
plyr.embed.api('pause');
plyr.media.paused = true;
};
plyr.media.stop = function() {
plyr.embed.api('stop');
plyr.media.paused = true;
};
plyr.media.paused = !config.autoplay; plyr.media.paused = !config.autoplay;
plyr.media.currentTime = 0; plyr.media.currentTime = 0;