0

I am using videojs to use HLS in Chrome but for a particular URL this fails (CORS issue) but in Safari it plays without problems.

I have a code in videojs but for figure out the problem faster, I used you this online player: https://videojs.github.io/videojs-contrib-hls/

For this file, problem is present in Chrome (but not in Safari): https://s3-us-west-2.amazonaws.com/andy-mediaconvert-tests/Haystack.tv/2019-05-10_Output/02_qvbr_ch1/ch1_hd720.m3u8

Other link like this works in both: https://d2ufudlfb4rsg4.cloudfront.net/bloomberg/IIrcyflxg/IIrcyflxg_medium.m3u8

Then, my question is, why Safari can play a video with CORS issue but Chrome not?. Or how Safari avoid the CORS issue? to try to reproduce it in Chrome.

  • https://stackoverflow.com/questions/13421463/htaccess-access-control-allow-origin is this any help? – David Jun 20 '19 at 16:11

1 Answers1

2

CORS is enforced by the browser, not the server. So it’s up to the browser whether the resource is blocked or accessed. In the case is chrome, the video segments are downloaded via XHR, and therefore are handled by the browser HTTP stack. In the case of safari, which natively supports HLS, the segments are downloaded by the media player directly, bypassing the browser, and thus CORS.

This behavior can not be reproduced in chrome.

szatmary
  • 29,969
  • 8
  • 44
  • 57