Home / IOS Development / Stream AWS S3 HLS videos in iOS browsers

Stream AWS S3 HLS videos in iOS browsers



How can I stream HLS (.m3u8) in Safari Safari browsers? My videos are stored in AWS S3 Bucket and the only way to access video and audio .m3u8 is sending a signed URL.

I use videojs to stream videos. videojs.Hls.xhr.beforeRequest does not work on iOS browsers. I also read that MSE is not supported in iOS, is there any option I can use to send a signed URL to be able to stream my videos in iOS browsers?

Here are my examples and screenshots of errors:

videojs.Hls.xhr.beforeRequest = function(options) {

               
                if (options.uri.includes('Audio')) {
                    options.uri = options.uri + '?Policy=' + policy + '&Key-Pair-Id=' + keyPairId + '&Signature=" + signature;

                }
                else if (options.uri.includes("Video')) {
                    options.uri = options.uri + '?Policy=' + policy + '&Key-Pair-Id=' + keyPairId + '&Signature=" + signature;
                   
                }

                return options
}

var overrideNative = false;

var player = videojs("video-test', {
  "controls": true,
        "fluid": true,
        "preload": 'none',
        "techOrder": ["html5"],
        "html5": {
            "hls": {
                "withCredentials": true,
                 overrideNative: overrideNative,
                        
                 
                }, 
        },
            nativeVideoTracks: !overrideNative,
            nativeAudioTracks: !overrideNative,
            nativeTextTracks: !overrideNative
        });

player.src(
{
   src: url, type: "application/x-mpegURL", withCredentials: true
});

enter image description here


Source link