Replace provider switch plyr.js with conditions
This commit is contained in:
parent
2aa967aba9
commit
87ea5e14b4
@ -1028,50 +1028,37 @@ class Plyr {
|
|||||||
// Stop playback
|
// Stop playback
|
||||||
this.stop();
|
this.stop();
|
||||||
|
|
||||||
// Type specific stuff
|
// Provider specific stuff
|
||||||
switch (`${this.provider}:${this.type}`) {
|
if (this.isHTML5) {
|
||||||
case 'html5:video':
|
// Clear timeout
|
||||||
case 'html5:audio':
|
clearTimeout(this.timers.loading);
|
||||||
// Clear timeout
|
|
||||||
clearTimeout(this.timers.loading);
|
|
||||||
|
|
||||||
// Restore native video controls
|
// Restore native video controls
|
||||||
ui.toggleNativeControls.call(this, true);
|
ui.toggleNativeControls.call(this, true);
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
done();
|
done();
|
||||||
|
} else if (this.isYouTube) {
|
||||||
|
// Clear timers
|
||||||
|
clearInterval(this.timers.buffering);
|
||||||
|
clearInterval(this.timers.playing);
|
||||||
|
|
||||||
break;
|
// Destroy YouTube API
|
||||||
|
if (this.embed !== null && is.function(this.embed.destroy)) {
|
||||||
|
this.embed.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
case 'youtube:video':
|
// Clean up
|
||||||
// Clear timers
|
done();
|
||||||
clearInterval(this.timers.buffering);
|
} else if (this.isVimeo) {
|
||||||
clearInterval(this.timers.playing);
|
// Destroy Vimeo API
|
||||||
|
// then clean up (wait, to prevent postmessage errors)
|
||||||
|
if (this.embed !== null) {
|
||||||
|
this.embed.unload().then(done);
|
||||||
|
}
|
||||||
|
|
||||||
// Destroy YouTube API
|
// Vimeo does not always return
|
||||||
if (this.embed !== null && is.function(this.embed.destroy)) {
|
setTimeout(done, 200);
|
||||||
this.embed.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean up
|
|
||||||
done();
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'vimeo:video':
|
|
||||||
// Destroy Vimeo API
|
|
||||||
// then clean up (wait, to prevent postmessage errors)
|
|
||||||
if (this.embed !== null) {
|
|
||||||
this.embed.unload().then(done);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vimeo does not always return
|
|
||||||
setTimeout(done, 200);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user