-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
No way to set poster image after initialization #525
Comments
The first option would be helpful to me. Thanks. |
Both options would be good, I'm having the same problem. |
The first option looks best to me. The best approach would probably be to trigger a 'posterchange' event any time poster(src) is set, and then have the poster component listen for that event and update the poster source depending on how it was originally set. https://github.com/videojs/video.js/blob/master/src/js/poster.js#L31 |
@heff Yeah, that sounds like a good solution. |
What's the purpose of having a separate poster image rather than using the Posters don't seem to be displayed on iOS devices in the current implementation, and trying to append the poster attribute after initialization doesn't seem to work (which I think is the topic of this post). Would love to chip in here, but not sure why the poster attribute isn't being used in the first place. |
Trying to remember all the details, but I know there are/were a few reasons for creating a custom one.
The older versions of Safari probably aren't a concern anymore, but I wouldn't want to kill the poster component because of Flash and potential other future techs that may not support a poster image, e.g. Quicktime or Divx. |
I dont think that's quite accurate. When you load an image 'as data' (i.e. in a way that allows you to read pixel values) then you're subject to cross-origin restrictions and policies. When you load it merely to put it on the stage, there is no cross-origin restriction, or other security restriction that i know of. Of course, that doesnt mean it isnt best to have a separate html element, I'd have to think about that. Given that the controls have already established an html-over-flash pattern, it seems fine to continue that way to me. |
Here's the last conversation I was able to find on the matter with @alemay. I don't think we ever moved to bytes, and not clear on why Andy wanted to avoid that. Either way, I'm not seeing a strong need to kill the poster image yet.
|
AFAIK, resizing would not cause that. There's a couple of different classes that can be used to load and display images, perhaps @alemay's comments refer to a more restrictive one. But maybe this is a red herring - maybe it should be an html element anyway - isnt that simpler? What's the downside? |
Yeah, not sure of any yet. But doesn't hurt to document all this either way. :) |
When poster() is called with a URL, set it to the PosterImage source and update the video element attribute.
When poster() is called with a URL, fire a `posterchange` event to update the PosterImage source and update the video element attribute.
When poster() is called with a URL, fire a `posterchange` event to update the PosterImage source and update the video element attribute.
When poster() is called with a URL, fire a `posterchange` event to update the PosterImage source and update the video element attribute.
I found out another way:
|
My working code: |
We also have a player.loadMedia({
src: {
src: 'video.mp4',
type: 'video/mp4'
},
poster: 'poster.png'
}); |
After initialization, there is no way to set the poster image.
The player does have a .poster(src) function, but it doesnt change have any effect on the poster image src after initialization.
There are two possible fixes:
improve the .poster() function to handle changes to the poster at any time
allow a poster attribute to be passed with src, eg.
Does anyone have a preference?
The text was updated successfully, but these errors were encountered: