Wait for the metadata to be loaded before setting the currentTime
This commit is contained in:
parent
25a319d884
commit
61f4b998e1
@ -99,6 +99,13 @@ const html5 = {
|
||||
// Set new source
|
||||
player.media.src = supported[0].getAttribute('src');
|
||||
|
||||
// Restore time
|
||||
const onLoadedMetaData = () => {
|
||||
player.currentTime = currentTime;
|
||||
player.off('loadedmetadata', onLoadedMetaData);
|
||||
};
|
||||
player.on('loadedmetadata', onLoadedMetaData);
|
||||
|
||||
// Load new source
|
||||
player.media.load();
|
||||
|
||||
@ -107,9 +114,6 @@ const html5 = {
|
||||
player.play();
|
||||
}
|
||||
|
||||
// Restore time
|
||||
player.currentTime = currentTime;
|
||||
|
||||
// Trigger change event
|
||||
utils.dispatchEvent.call(player, player.media, 'qualitychange', false, {
|
||||
quality: input,
|
||||
|
Loading…
x
Reference in New Issue
Block a user