chrisboustead / videojs-hls-quality-selector

Adds a quality selector menu for HLS sources played in videojs. Requires `videojs-contrib-quality-levels` plugin.
MIT License
140 stars 103 forks source link

Fix quality selector labels for portrait videos #67

Closed LitoMore closed 2 years ago

LitoMore commented 3 years ago

The current logic is that we only pick height for labels in the quality list.

But not all videos are landscape mode, we should support portrait mode videos.

Logic overview

Before

const label = quality.height + 'p';

After

const {width, height} = quality;
const pixels = width > height ? height : width;
const label = pixels + 'p';
LitoMore commented 3 years ago

I patched this quick fix with my fork package. If anyone wants this in a hurry:

npm i @litomore/videojs-hls-quality-selector

Source: https://github.com/LitoMore/videojs-hls-quality-selector/tree/package/fix-quality-selector