title: Stream AWS S3 HLS Videos in iOS Browsers
body: <p>How can I stream HLS(.m3u8) in iOS Safari Browsers? My videos are stored in AWS S3 Bucket and the only way to access the video and audio <code>.m3u8</code> is to pass a signed URL.</p>
  <p>I am using <code>videojs</code> to stream videos.  <code>videojs.Hls.xhr.beforeRequest</code> is not working on iOS browsers.  I also read that MSE is not supported in iOS, is there any alternative I can use to pass a signed URL to be able to stream my videos on iOS browsers?</p>
  <p>Here are my sample codes and screenshot of error:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>videojs.Hls.xhr.beforeRequest = function(options) {
  
                 
                  if (options.uri.includes('Audio')) {
                      options.uri = options.uri + '?Policy=' + policy + '&amp;Key-Pair-Id=' + keyPairId + '&amp;Signature=' + signature;
  
                  }
                  else if (options.uri.includes('Video')) {
                      options.uri = options.uri + '?Policy=' + policy + '&amp;Key-Pair-Id=' + keyPairId + '&amp;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
  });</code></pre>
  </div>
  </div>
  </p>
  <p><a href="https://i.stack.imgur.com/7oCQ3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7oCQ3.png" alt="enter image description here" /></a></p>