fix(vjs-player): replace HLS quality plugin and add plugin guards

Swap videojs-hls-quality-selector for videojs-quality-selector-hls
and update package versions. Initialize plugins defensively: call the
new quality selector via qualitySelectorHls when available and wrap
both quality selector and aspectRatioPanel initializations in try/catch
blocks to avoid runtime errors if a plugin fails to load. Bump project
version to 0.18.0 and add the new dependency and packageManager entry.
This commit is contained in:
4gray committed 2026-01-13 19:50:36 +01:00
1 parent 1bbad6920a
commit 8662fa90c6
4 files changed
+38 -46

No files matched your search

@@ -12,7 +12,7 @@ import {
import '@yangkghjh/videojs-aspect-ratio-panel';
import videoJs from 'video.js';
import 'videojs-contrib-quality-levels';
import 'videojs-hls-quality-selector';
import 'videojs-quality-selector-hls';
/**
* This component contains the implementation of video player that is based on video.js library
@@ -56,10 +56,22 @@ export class VjsPlayerComponent implements OnInit, OnChanges, OnDestroy {
});
}
);
this.player.hlsQualitySelector({
displayCurrentQuality: true,
});
this.player['aspectRatioPanel']();
try {
if (typeof this.player.qualitySelectorHls === 'function') {
this.player.qualitySelectorHls({
displayCurrentQuality: true,
});
}
} catch (e) {
console.warn('qualitySelectorHls plugin failed to initialize:', e);
}
try {
if (typeof this.player['aspectRatioPanel'] === 'function') {
this.player['aspectRatioPanel']();
}
} catch (e) {
console.warn('aspectRatioPanel plugin failed to initialize:', e);
}
}
/**