dominic-p / videojs-resolution-selector

Adds a resolution selector button to Video.js to allow users to manually adjust the video quality.
MIT License
88 stars 31 forks source link

Taking Source Type Into Account #5

Closed AssaultedPeanut closed 10 years ago

AssaultedPeanut commented 10 years ago

Hi. Thanks for all the work on this!

A small problem though: the onClick method doesn't seem to take the 'type' into account. With the following source list, Opera webkit plays the 540P WebM file, then onClick() for 288P sets the source to the 288P OGV file (rather than the WebM version), ditto a further click back to the 540P version sets the 540P OGV file.

The effect of switching between formats as well as resolution is to bring up the poster image and then to only be able to hear the audio in the background, the video doesn't visibly play.

<source src="/data/video/add_favourite_numbers_h264mp4_960x540.mp4" type="video/mp4" data-res="540P">
<source src="/data/video/add_favourite_numbers_vp8webm_960x540.webm" type="video/webm" data-res="540P">
<source src="/data/video/add_favourite_numbers_theoraogg_960x540.ogv" type="video/ogg" data-res="540P">
<source src="/data/video/add_favourite_numbers_h264mp4_480x272.mp4" type="video/mp4" data-res="288P">
<source src="/data/video/add_favourite_numbers_vp8webm_480x272.webm" type="video/webm" data-res="288P">
<source src="/data/video/add_favourite_numbers_theoraogg_480x272.ogv" type="video/ogg" data-res="288P">

I believe @onyxrev's version handled resolution switching between identical types to solve this problem, but his version is not VideoJS v4 compatible it seems. I'm stuck trying to fix this as I don't know how to find the 'type' of the currently playing video :(

dominic-p commented 10 years ago

That's definitely some unusual behavior. Do you have an example link we could look at to see this in action?

The plugin is supposed to pass a source array to the player object's src function that includes all available types at the selected resolution. Then, it should be up to the browser to choose the type it can play. This is should be equivalent to providing a list of <source /> elements within a <video /> tag.

I haven't tested the plugin in Opera though, so there might be some quirks with that browser. I would be curious to see what your player().availableRes object looks like.

AssaultedPeanut commented 10 years ago

Apologies, but no link to show. Up against a deadline so before you replied I reverted to @onyxrev's version and got that working in VJS 4.5 (had been using 4.3). Sorry, I'm now unable to rollback to your version to get you the availableRes result. Thanks for the reply, sorry there's not much more for your to go on.