Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

vit-koumar
Copy link

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 setting currentTime 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.

@gkatsev
Copy link
Member

gkatsev commented Feb 22, 2016

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.

@vit-koumar
Copy link
Author

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?

@vit-koumar
Copy link
Author

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');
Copy link
Member

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.

@gkatsev
Copy link
Member

gkatsev commented Mar 7, 2016

One final small change, LGTM otherwise. Thanks.

@gkatsev gkatsev added minor This PR can be added to a minor release. It should not be added to a patch release. needs: LGTM Needs one or more additional approvals labels Mar 7, 2016
@gkatsev gkatsev added in progress needs: updates and removed needs: LGTM Needs one or more additional approvals labels Mar 14, 2016
@vit-koumar
Copy link
Author

Thanks for the comment, I have amended the change. Is there anything else to do before merge, eg. some tests, docs, etc. ?

@gkatsev
Copy link
Member

gkatsev commented Mar 17, 2016

Adding unit tests would be great!

@vit-koumar
Copy link
Author

Unit tests added.

@gkatsev
Copy link
Member

gkatsev commented May 3, 2016

Hey, looks like this branch got into conflict with master, can you rebase or merge in master and fix the conflicts?

@gkatsev gkatsev added the needs: LGTM Needs one or more additional approvals label May 3, 2016
@vit-koumar
Copy link
Author

Rebased, conflict solved (+changed commit messages to conform your style)

@gkatsev
Copy link
Member

gkatsev commented May 11, 2016

Awesome, thanks @vit-koumar.

@brandonocasey
Copy link
Contributor

LGTM

@gkatsev gkatsev added confirmed and removed needs: LGTM Needs one or more additional approvals labels Jul 18, 2016
@gkatsev gkatsev closed this in f36da27 Jul 18, 2016
@gkatsev
Copy link
Member

gkatsev commented Jul 18, 2016

Thanks @vit-koumar! Should have a release soon.

@gkatsev
Copy link
Member

gkatsev commented Jul 20, 2016

@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

@vit-koumar
Copy link
Author

Yes, I will have a look.

}
};
result = duration.call(mockFlash);
ok(Number.isNaN(result), 'duration returns NaN when readyState equals 0');
Copy link
Member

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.

@gkatsev
Copy link
Member

gkatsev commented Jul 22, 2016

@vit-koumar hey, I fixed it. See #3453.

@vit-koumar
Copy link
Author

Nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed minor This PR can be added to a minor release. It should not be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants