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

Add canPlayType method to player #2709

Closed
wants to merge 3 commits into from
Closed

Add canPlayType method to player #2709

wants to merge 3 commits into from

Conversation

nickygerritsen
Copy link
Contributor

This should be the code for #2701 including some tests.

I'm not sure this is what is wanted exactly, but I'm of course open to comments. For example, does it make more sense to let player.canPlayType return a boolean? I had that at first but then decided that returning the maybe / probably thingy isn't any more work and maybe more helpful?

For testing, there is only one small test for player.canPlayType, but I couldn't find any tests for things link selectSource so I did not really have anything to base my tests upon.

@pam
Copy link

pam commented Oct 16, 2015

Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 991b6e801687ea29adf469923a3f5d1a188af1a1
Build details: https://travis-ci.org/pam/video.js/builds/85802142

(Please note that this is a fully automated comment.)

@nickygerritsen
Copy link
Contributor Author

This one seems to have the same Vista error btw :(

@nickygerritsen nickygerritsen mentioned this pull request Oct 27, 2015
18 tasks
@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

If you rebase against master, I think the test failures will go away.


// Check if the browser supports this technology
if (tech.isSupported()) {
can = tech.canPlayType(type);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the tech's canPlayType check whether it is supported itself?
I guess the downside is that you won't know whether it can't because it isn't supported or because it can't play that type if you ask the tech directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also kinda copied this from selectSource, to keep them "in sync".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping them in sync might not be a bad idea. Not certain which I like more.
Do you have a strong preference, @nickygerritsen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No not really, although maybe when we want to add support for #2705 that it would be better to add the isSupported call inside the tech. Otherwise we need to duplicate that again there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, thinking about it some more, I think I like keeping the isSupported out of canPlayType. Makes canPlayType super simple and do exactly one thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK then an update is incoming in 3...

@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

Thanks @nickygerritsen for the PR. I made a few comments but it generally looks good!

@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

LGTM.

@pam
Copy link

pam commented Oct 27, 2015

Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 9ddaeca4a51ec9c820e34a3fa4f645f29c5b75d5
Build details: https://travis-ci.org/pam/video.js/builds/87695612

(Please note that this is a fully automated comment.)

@nickygerritsen
Copy link
Contributor Author

Vista IE9 still seems to be broken :(

@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

Travis passed but the savage tests are broken right now (fixed in master).

@nickygerritsen
Copy link
Contributor Author

Hmmm but if I'm not mistaken I did rebase onto master. But maybe my git skills failed

@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

I can have pam retry the tests.
@pam retry

@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

@pam retry

@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

@nickygerritsen looks like it didn't get picked up since you're missing some commits. Make sure you have the latest master. There were a bunch of stuff committed yesterday :)

@nickygerritsen
Copy link
Contributor Author

Ah now I should have the correct master :)

can = handlers[i].canPlayType(type);

if (can) {
return can;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: indentation issue here.

@dmlap
Copy link
Member

dmlap commented Oct 27, 2015

There's a couple indent issues in player.js besides the ones I pointed out. Otherwise, LGTM

@nickygerritsen
Copy link
Contributor Author

Not sure what went wrong there but fixed anyways

@pam
Copy link

pam commented Oct 27, 2015

Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 3d85440
Build details: https://travis-ci.org/pam/video.js/builds/87720352

(Please note that this is a fully automated comment.)

@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

Hurray all green! (technically)

@pam
Copy link

pam commented Oct 27, 2015

Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 9ddaeca4a51ec9c820e34a3fa4f645f29c5b75d5
Build details: https://travis-ci.org/pam/video.js/builds/87717117

(Please note that this is a fully automated comment.)

@pam
Copy link

pam commented Oct 27, 2015

Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: c88eddf
Build details: https://travis-ci.org/pam/video.js/builds/87719620

(Please note that this is a fully automated comment.)

@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

Ignore those last two. They're old builds.

@gkatsev gkatsev closed this in 589cab7 Oct 27, 2015
@gkatsev
Copy link
Member

gkatsev commented Oct 27, 2015

Thanks!

@nickygerritsen
Copy link
Contributor Author

\o/

dmlap pushed a commit to videojs/videojs-contrib-hls that referenced this pull request Nov 16, 2015
If someone calls player.canPlayType() with HLS registered as a source handler, it would fail at runtime. Related to videojs/video.js#2709.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants