-
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
Listen for posterchange on tech #2339
Conversation
When someone is using a YouTube video and doesn't have a poster, we need to put the YouTube default poster. However, this is an async process. We need to check if the highres version exists. If it doesn't we use the low res. To make that possible, the player has to listen for posterchange on the tech and trigger it again on himself so that the poster can set himself correctly.
I'm not understanding why the player needs to get involved in this process. If the youtube player is handling the poster, it seems like the process of deciding which poster to use should be in a black box as far as the player is concerned. |
Even though |
Right now the poster attribute is really only used by the PosterImage component. We assume:
While the poster is passed to the tech, it's more of a fallback, and I think it's rare that the tech's poster would actually show up whenever the user does supply a poster. We currently don't ever assume the tech has the source of the poster, however we do still let the tech know, but again, it's more of a fallback. The If the tech triggers a Can the youtube tech provide a image source (jpeg, etc.) that the PosterImage component could read and display? Do we need to treat the poster similarly to controls and tracks, where there's native (tech) vs custom (player) supplied versions of each, and you can choose between them some how? |
If the user set a poster on VJS, we should use it no matter what of course. However, if none is provided, we need to set the default YouTube poster otherwise we will see a big red play button in the middle with it. All the YouTube tech needs is a fallback poster that can be used if the user didn't provided one. Is there any way to do that right now? |
Ok, so you're saying when you load a YouTube video with the YouTube player, it provides a URL to a poster image (jpeg or whatever) that we can use in the video.js player's PosterImage component, so that it covers up the YouTube play button. Is that right? |
It will cover the whole iframe yep. Only way to get rid of that ugly button we don't want twice (VJS already got one). |
Ok cool, so this is specifically what I was looking to understand. The youtube player does have a poster url we could point to if the user doesn't provide one. So this is yet another twist in the player/tech relationship. It's kind of like the native/custom controls and native/custom tracks, except that in this case we would always be using the custom poster and the source would either be coming from the user or the tech. I think the next step here would be to update the poster function to get the poster from the tech if there's no user supplied poster.
Then ideally the Another note on this is that this means you can't ever disable the poster with this setup. I'm not sure why a user would want to do that though. |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 1086989 (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 57e53b0 (Please note that this is a fully automated comment.) |
@heff This should fix the default poster for any tech.
None of this is done if their is a specified poster. |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 647354a (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 2f341b1 (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 810d619 (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: e4a6713 (Please note that this is a fully automated comment.) |
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 48ca3a0 (Please note that this is a fully automated comment.) |
Had to switch a few unit tests to use HTML5 because poster() on the Flash version isn't working without mocking a few things. |
@heff What's the plan on the VJS5 release? This PR is critical for the YouTube tech to work correctly. |
@eXon Trying to get it out tomorrow. Reviewing this one now. If I see any changes I'll make a note but try to change them myself. |
@@ -67,7 +67,7 @@ test('should accept options from multiple sources and override in correct order' | |||
videojs.options.attr = 1; | |||
|
|||
let tag0 = TestHelpers.makeTag(); | |||
let player0 = new Player(tag0); | |||
let player0 = new Player(tag0, { techOrder: ['html5'] }); |
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.
We have a 'techFaker' tech that I think could be used here instead of html5. It would be technically safer on IE8.
Made suggestions here: https://github.com/eXon/video.js/pull/1 |
Review exon patch 2
I think it's even better to be able to tell VJS that the default poster has changed. Thank you for the help! :) |
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 9d0453a (Please note that this is a fully automated comment.) |
When someone is using a YouTube video and doesn't have a poster, we need to put the YouTube default poster. However, this is an async process. We need to check if the highres version exists. If it doesn't we use the low res.
To make that possible, the player has to listen for posterchange on the tech and trigger it again on himself so that the poster can set himself correctly.