videojs / videojs-contrib-quality-levels

Other
157 stars 51 forks source link

How do you turn auto-switching off when the user selects a specific quality level? #153

Closed pac96 closed 1 month ago

pac96 commented 1 month ago

I have a menu bar with an "auto" button similar to YouTube that is meant to enable auto-resolution switching. I want to turn the feature off until the user clicks the auto button again. When they click a specific resolution, like 720p, I want them to see the video at 720p for the duration of the video until they click the auto button again. The documentation does not specify any way to do this, and I am using this plugin with videojs HLS. Can you help me understand how I can implement this? If possible, can you all also update the documentation to be a bit clearer?

I also have another issue when I follow the documentation: including the code to trigger a quality level change does not actually change the resolution. The way the docs are written make it seem like if you use videojs/http-streaming with videojs-contrib-quality-levels the following functionality should effectively update the resolution source:

qualityLevels.selectedIndex_ = 0;
qualityLevels.trigger({ type: 'change', selectedIndex: 0 });

Am I misunderstanding here? Any help would be greatly appreciated!

adrums86 commented 1 month ago

Hi @pac96 , the documentation for this plugin could definitely use some work. Also a helper method for this plugin is likely necessary. For an example of how to properly enable and disable quality levels I would take a look at the handleClick function of the quality-menu plugin: https://github.com/videojs/videojs-contrib-quality-menu/blob/356341602d796a93cd1e305c1c8136b776a602b4/src/quality-menu-item.js#L103.

Also, take a look at @gkatsev 's comment on this issue. https://github.com/videojs/videojs-contrib-quality-levels/issues/150#issuecomment-2400902554

Hope this helps!