allow changing options.paused before metadata is loaded, trigger loadedmetadata event
This commit is contained in:
parent
6169a4e6ec
commit
0fc0e671e1
1 changed files with 5 additions and 5 deletions
|
@ -1663,7 +1663,7 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
|
|
||||||
setPosition(self.options.position);
|
setPosition(self.options.position);
|
||||||
self.$video.muted(self.options.muted).volume(self.options.volume);
|
self.$video.muted(self.options.muted).volume(self.options.volume);
|
||||||
|
|
||||||
if (!self.options.paused) {
|
if (!self.options.paused) {
|
||||||
self.options.paused = true;
|
self.options.paused = true;
|
||||||
togglePaused('button');
|
togglePaused('button');
|
||||||
|
@ -1689,7 +1689,7 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
if (self.options.enableKeyboard && self.options.focus == 'load') {
|
if (self.options.enableKeyboard && self.options.focus == 'load') {
|
||||||
that.gainFocus();
|
that.gainFocus();
|
||||||
}
|
}
|
||||||
|
that.triggerEvent('loadedmetadata');
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadedsubtitles() {
|
function loadedsubtitles() {
|
||||||
|
@ -2268,13 +2268,13 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function togglePaused(from) {
|
function togglePaused(from) {
|
||||||
if (!self.loadedMetadata) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
self.options.paused = !self.options.paused;
|
self.options.paused = !self.options.paused;
|
||||||
self.$timeline && self.$timeline.options({
|
self.$timeline && self.$timeline.options({
|
||||||
paused: self.options.paused
|
paused: self.options.paused
|
||||||
});
|
});
|
||||||
|
if (!self.loadedMetadata) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (self.options.paused) {
|
if (self.options.paused) {
|
||||||
self.$video.pause();
|
self.$video.pause();
|
||||||
clearInterval(self.playInterval);
|
clearInterval(self.playInterval);
|
||||||
|
|
Loading…
Reference in a new issue