videojs / videojs-contrib-hls

HLS library for video.js
http://videojs.github.io/videojs-contrib-hls/
Other
2.84k stars 793 forks source link

Cannot find stream in URL with parameters #1191

Closed beautylix closed 6 years ago

beautylix commented 7 years ago

Description

Briefly describe the issue. Cannot find the stream in URL with parameter on pc Works well on iphone

Sources

http://live.g3proxy.lecloud.com/gslb?stream_id=lb_mv_1000&tag=live&ext=m3u8&sign=live_tv&platid=10&splatid=1009&format=letv&expect=1

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. input the url in your player, it shows stream not found
  2. play in iphone with the same url, it works well
  3. Paste the url in https://www.hlsplayer.net/, it works well

Error output

Stream not found

videojs-contrib-hls version

Latest version

videojs version

what version of videojs does this occur with? video.js 5.0

Browsers

what browsers are affected? please include browser and version for each Firefox, chrome

Platforms

Windows 7, centos 7

Other JavaScript

are you using any other javascript libraries or frameworks on the page? if so please list them below. * No

mister-ben commented 7 years ago

You need to enable CORS on the server. https://enable-cors.org/

iOS works because its native HLS playback does not make XHR requests. The player at hlsplayer.net is probably Flash-based as there's just a big empty box in my browser; Flash has a different mechanism to handle cross origin requests.

beautylix commented 7 years ago

There is not CORS error, CORS error has different error output. Current player can only read URL like http:/domain.com/a/b/c.m3u8, but cannot read stream from URL like http://domain.com/index?id=3&extent=m3u8&token=123

mjneil commented 7 years ago

This is the error I get when trying to load your stream

XMLHttpRequest cannot load http://live.g3proxy.lecloud.com/gslb?stream_id=lb_mv_1000&tag=live&ext=m3u8&sign=live_tv&platid=10&splatid=1009&format=letv&expect=1. Redirect from 'http://live.g3proxy.lecloud.com/gslb?stream_id=lb_mv_1000&tag=live&ext=m3u8&sign=live_tv&platid=10&splatid=1009&format=letv&expect=1' to 'http://23.248.182.24/m3u8/lb_mv_1000/desc.m3u8?stream_id=lb_mv_1000&path=23…&geo=US-107-0-100&tmn=1499811147&pnl=955,955,939,512&ext=m3u8&sign=live_tv' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 
beautylix commented 7 years ago

Is there any code available to overcome CORS or crossdomain obstruct? jsonp or other methods?

mister-ben commented 7 years ago

JSONP doesn't apply as you're not fetching JSON. You need to fix CORS by adding headers at the server. You cannot circumvent it on the client side.

beautylix commented 7 years ago

The CORS question has been resolved, and data stream look well, but there is still no video and audio.

Test URL

https://crossorigin.me/http://live.gslb.letv.com/gslb?stream_id=lb_mv_1300&tag=live&ext=m3u8&sign=live_tv&platid=10&splatid=1009&format=letv&expect=1

How to fix it?

mister-ben commented 7 years ago

That proxy is only adding CORS headers to the master playlist. The playlist contains absolute URLs to another server that does not use CORS headers. This is easily verifiable in the console, you'll see

XMLHttpRequest cannot load http://23.248.182.28/121/33/98/letv-uts/14/ver_00_22-303050723-avc-1153420-…tmcd=106&buss=5997&cips=65.122.49.226&source=vod&ver=live_3&ntm=1500153000. No 'Access-Control-Allow-Origin' header is present on the requested resource.
gesinger commented 7 years ago

Hey @beautylix , were you able to add CORS headers for the other requests within the playlist?

gesinger commented 6 years ago

Closing for now. If you are still having trouble, please let us know. Thank you.