hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Streams with a port address specified do not load

Open xplorr opened this issue 9 years ago • 4 comments

Environment
  • [x ] The stream has correct Access-Control-Allow-Origin headers (CORS)
  • [x ] There are no network errors such as 404s in the browser console when trying to play the stream
  • [x ] The issue observed is not already reported by searching on Github under https://github.com/video-dev/hls.js/issues
  • [x ] The issue occurs in the latest reference client on http://video-dev.github.io/hls.js/demo and not just on my page
  • Link to playable M3U8 file: examples: applies to all and more Dobbit TV: http://193.110.252.20:1935/live/dobbittv.stream/playlist.m3u8 CNN: http://109.123.114.178:1935/Livenewson/Livenewson/playlist.m3u8 Africa TV: http://africatv.live.net.sa:1935/live/africatv/playlist.m3u8 and all URL's with a port address specified ':' do not stream in hls.js

  • Hls.js version: 0.7.5 and lower

  • Browser name/version: Chromium Version 59.0.3067.0 (Official Build) (64-bit)

  • OS name/version: Windows 10

Steps to reproduce
  1. Please provide clear steps to reproduce your problem: just load above url's in hls.js demo page
  2. Whenever possible, share a demo/example page which reproduces the problem you are having with the least amount of code possible.
  3. If the bug is intermittent, give a rough frequency if possible
Expected behavior

What you expected to happen: plays in other HLS players

Actual behavior

What actually happened: "cannot Load URL HTTP response code:0 this might be a CORS issue, consider installing Allow-Control-Allow-Origin Chrome Extension,network error ..."

Console output
Paste the contents of the browser console here.
For media errors reported on Chrome browser, please also paste the output of chrome://media-internals 

xplorr avatar Apr 24 '17 17:04 xplorr

Definition from MDN: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

A resource makes a cross-origin HTTP request when it requests a resource from a domain or port which is different from the one which the first resource itself serves.

For security reasons, browsers restrict cross-origin HTTP requests initiated from within scripts. For example, XMLHttpRequest and Fetch follow the same-origin policy. So, a web application using XMLHttpRequest or Fetch could only make HTTP requests to its own domain. To improve web applications, developers asked browser vendors to allow cross-domain requests.

So in order to playback those streams you need to have the source add the CORS header or bypass with a proxy.

jgainfort avatar Apr 24 '17 22:04 jgainfort

Thank you for your answer, but this contradicts with the behavior I found in other applications:

1/ when I install the Google chrome extension "Play HLS M3U8" (https://chrome.google.com/webstore/detail/play-hls-m3u8/ckblfoghkjhaclegefojbgllenffajdc) all the above mentionned URL's with port address play well: I repeat some examples: CNN: http://109.123.114.178:1935/Livenewson/Livenewson/playlist.m3u8 Africa TV: http://africatv.live.net.sa:1935/live/africatv/playlist.m3u8

2/ Also when I disable this extension, the m3u8 files download correctly. So both Chrome and it's applications/extensions/scripts handle these URL's correctly, so this leaves me with my first conclusion that HLS.js does not handle these URL's correctly.

3/ Also flash players load/play these streams correctly: https://developer.jwplayer.com/tools/stream-tester/

Is there a bypassing solution for this problem in the meanwhile? Or will it be fixed in the next release?

xplorr avatar Apr 25 '17 13:04 xplorr

Hi @xplorr

this Chrome Extension has permissions to perform Cross Domain request see https://developer.chrome.com/extensions/xhr and https://github.com/gramk/chrome-hls/blob/master/manifest.json#L8-L14

"direct download" is not subject to CORS Flash players uses crossdomain.xml

mangui avatar Apr 25 '17 14:04 mangui

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 16 '18 03:06 stale[bot]