@@ -89,6 +89,18 @@ import 'video.js/dist/video-js.css';
8989import ' videojs-contrib-quality-levels' ;
9090import ' @silvermine/videojs-chromecast/dist/silvermine-videojs-chromecast.css' ;
9191
92+
93+ /* --- ADD: Native HLS detection for Apple browsers (minimal, additive) --- */
94+ const __isIOSLike__ =
95+ / iP(hone| od| ad)/ .test (navigator .platform ) ||
96+ / iPad| iPhone| iPod/ .test (navigator .userAgent ) ||
97+ (/ Macintosh/ .test (navigator .userAgent ) && ' ontouchend' in document );
98+
99+ const __isSafari__ = / ^ ((?!chrome| android). )* safari/ i .test (navigator .userAgent );
100+ const __useNativeHls__ = __isIOSLike__ || __isSafari__;
101+ /* --- END ADD --- */
102+
103+
92104// Make videojs available globally for plugins
93105window .videojs = videojs;
94106
@@ -491,7 +503,26 @@ const initializePlayer = async () => {
491503 };
492504
493505 // Initialize Video.js player
494- player = videojs (videoPlayer .value , options, function () {
506+
507+ // --- ADD: Prefer native HLS on iOS/Safari without changing original options ---
508+ try {
509+ if (typeof __useNativeHls__ !== ' undefined' && __useNativeHls__) {
510+ if (typeof options !== ' undefined' && options) {
511+ options .techOrder = [' html5' ];
512+ if (options .html5 && options .html5 .vhs ) {
513+ options .html5 .vhs .overrideNative = false ;
514+ } else {
515+ options .html5 = options .html5 || {};
516+ options .html5 .vhs = options .html5 .vhs || {};
517+ options .html5 .vhs .overrideNative = false ;
518+ }
519+ }
520+ }
521+ } catch (e) {
522+ // no-op
523+ }
524+ // --- END ADD ---
525+ player = videojs (videoPlayer .value , options, function () {
495526 // Player is ready
496527 console .log (' Video.js player ready' );
497528
0 commit comments