-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flash tech duration getter returns Infinity instead of negative value #3128
Conversation
Should this do a check to see if we have media enabled? Because the spec you linked says that a negative value can mean that there's no media. Otherwise, seems like a good change. |
I think the spec states that if no media is loaded, then the return value must be NaN. Do you think there should be a check for media load and if no media is loaded, then the return value should be NaN regardless of the duration returned by the player? |
So I changed the condition like if the readyState === 0 then it returns NaN (according to the standrd). Hope this is what you ment. |
if (this.readyState() === 0) { | ||
return NaN; | ||
} else { | ||
var duration = this.el_.vjs_getProperty('duration'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a let
instead.
One final small change, LGTM otherwise. Thanks. |
Thanks for the comment, I have amended the change. Is there anything else to do before merge, eg. some tests, docs, etc. ? |
Adding unit tests would be great! |
Unit tests added. |
Hey, looks like this branch got into conflict with master, can you rebase or merge in master and fix the conflicts? |
Rebased, conflict solved (+changed commit messages to conform your style) |
Awesome, thanks @vit-koumar. |
LGTM |
Thanks @vit-koumar! Should have a release soon. |
@vit-koumar hey, looks like there are some errors on IE. Would you be able to take a look? See https://travis-ci.org/videojs/video.js/builds/145613240 |
Yes, I will have a look. |
} | ||
}; | ||
result = duration.call(mockFlash); | ||
ok(Number.isNaN(result), 'duration returns NaN when readyState equals 0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this and Number.isFinite
below the two things causing issues. I'll fix it by including es6-shim
in the test builds.
@vit-koumar hey, I fixed it. See #3453. |
Nice, thanks! |
Description
Flash tech
duration
getter should return Infinity instead of negative values (which some players do return) as stated in HTML standard.This situation is solved in upper layer Player object, but sometimes
duration
getter is called from inside the Flash tech for example here which situation ends for example in inability of settingcurrentTime
when duration is negative.Specific Changes proposed
Explicit
duration()
function defined in js/tech/flash.js which returns Infinity instead of negative Number.Requirements Checklist
I will adapt the rest of project in case this change will be approved.