Skip to content

Commit

Permalink
Fix preload on html5 provider
Browse files Browse the repository at this point in the history
  • Loading branch information
yoriiis committed Jan 4, 2024
1 parent 3fe1c4c commit b6b65d6
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/providers/html5/html5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,7 @@ export default function Html5Provider(Player: any) {
* @returns The video is ready
*/
waitUntilVideoIsReady(): Promise<any> {
return new window.Promise<void>((resolve) => {
if (this.media.readyState >= 2 && this.media.duration) {
resolve()
} else {
// Listen both events
// "loadedmetadata" is not fired on Firefox
// "canplay" is not fired in iOS
this.media.addEventListener('loadedmetadata', resolve, { once: true })
this.media.addEventListener('canplay', resolve, { once: true })
}
})
return new window.Promise<void>((resolve) => resolve())
}

/**
Expand Down

0 comments on commit b6b65d6

Please sign in to comment.