This repository was archived by the owner on Sep 28, 2025. It is now read-only.
HTML5Video - Fix invalid getDuration method response#50
Open
joaopaulovieira wants to merge 3 commits intomasterfrom
Open
HTML5Video - Fix invalid getDuration method response#50joaopaulovieira wants to merge 3 commits intomasterfrom
joaopaulovieira wants to merge 3 commits intomasterfrom
Conversation
bb1c01a to
a7c13e4
Compare
a7c13e4 to
7884ce7
Compare
leandromoreira
approved these changes
Jul 5, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TL;DR: Fixes clappr/clappr#1910.
Currently, the
HTML5Videoplayback calls the_readymethod even if the HTMLMediaElement is not ready yet. This PR moves the_readycall to inside the_onLoadedMetadatamethod, which will be called after the HTMLMediaElement loadedmetadata event occurs.With this change, the
readyevent is only called after the HTMLMediaElement metadata is available.Changes
html5_video.js:_readycall insiderendermethod;_readycall inside_onLoadedMetadatamethod;ifstatements insiderendermethod;templatefor the to of class declaration;html5_video.test.js:_onLoadedMetadatamethod;How to test
readystate has updated on any Clappr scope.events: { onReady: function() { alert(`player.getDuration returns: ${this.getDuration()}`) } }on Clappr initial setup.A picture/video tells a thousand words
iMac with Firefox:
Before this PR:
After this PR:
iOS with Safari:
Before this PR:
After this PR: