kmoskwiak / videojs-resolution-switcher

Resolution switcher adds the ability to select the video quality in video.js player.
https://kmoskwiak.github.io/videojs-resolution-switcher/
Other
403 stars 243 forks source link

How to change the resolution automatically? #121

Open clyde1021 opened 6 years ago

clyde1021 commented 6 years ago

I would like to know if there is a way to automatically change the video resolution according to the bandwidth? Kind of like on Youtube with the "auto" resolution?

cinques commented 5 years ago

You need videojs 7.xx and HLS technology on the server

kellertobias commented 5 years ago

at least in chrome, you don't need HLS. you can use the NetworkConnection framework.

We also use this:

connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
connectionType = connection.effectiveType
downlinkMax = navigator.connection.downlinkMax || navigator.connection.downlink
dataSaving = navigator.connection.saveData || false

if (dataSaving) return 'low'
if(not downlinkMax) return 'low'
// now distinguish your resolution based on your video profiles and the downlinkMax (in Mbps)