Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Videojs HLS m3u8 files are not playing in iOS devices and safari browser

I am able to play the m3u8 files in the PC and android devices, but i am not able to play those files in the iOS mobile devices and safari browser, I disabled the overrideNative to 'true' for the android devices, so its working in the android. but we should not disable the native for iOS and safari, because iOS Safari uses a native player, so I have set the overridnative false for the iOS. but its not working. I am following new videojs versions.

videojs : 6.4.0

videojs contrib hls: 5.12.2

videojs flash: 2.0.1

Example

 <!DOCTYPE html>
    <html>
    <head>
    <meta charset=utf-8 />
    <title>videojs-contrib-hls</title>

    <link href="https://unpkg.com/[email protected]/dist/video-js.css" rel="stylesheet">
    <script src="https://unpkg.com/[email protected]/dist/video.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/videojs-flash.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/videojs-contrib-hls.js"></script>

    </head>
    <body>
      <h1>Video.js Example Embed</h1>
      <video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="600" height="268" 
       data-setup='{}'>
        <source src="https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8" type="application/x-mpegURL">
      </video>
      <script>
        let videojshls= videojs('my_video_1', {  html5: {  
        nativeAudioTracks: false,
        nativeVideoTracks: false,
        hls: {
          debug: true,
          overrideNative: false
        }
       }});
      </script>
    </body>
    </html>

example jsfiddle

please can anyone help me. thanks

like image 874
Sathish Kotha Avatar asked Jan 30 '23 02:01

Sathish Kotha


1 Answers

Try this http://jsfiddle.net/fxfktztx/1/. It works for me.

var overrideNative = false;

var player = videojs('example-video', {
  html5: {
    hls: {
      overrideNative: overrideNative
    },
    nativeVideoTracks: !overrideNative,
    nativeAudioTracks: !overrideNative,
    nativeTextTracks: !overrideNative
  }
});
player.play();

As far I know, videojs options should be passed when the player is initialised, either with data-setup attribute or directly into the constructor as I did in the example above.

like image 187
cgcladera Avatar answered Feb 03 '23 07:02

cgcladera