videojs / videojs-contrib-hls

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

local Filesystem & Cordova Error ? Project must be on a Webserver? #567

Closed michael-riha closed 8 years ago

michael-riha commented 8 years ago

Hey guys, i tested this lib on my webserver with various HLS Streams, and it works great!

So i wanted to give it a try inside of Adobe Cordova. After developing and previewing it on my local Filesystem I experienced that it was not possible to play a HLS Stream from file:// ... /index.html

_VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported. _

Can anybody tell me what's the dependency that it will not work locally and in this case in Adobe Cordova as well ?

THX a lot,*m

gkatsev commented 8 years ago

Unfortunately, we cannot play back from file://. That is because we use XmlHttpRequest (XHR) to load the HLS manifests and segments and file:// is disallowed from XHR. For bests results, we really do urge you to use a webserver with CORS enabled.

michael-riha commented 8 years ago

Thanks @gkatsev for this quick response.

If I may, i have an additional Question on that subject.

This CORS Problem results because of the *.m3u Parser, right? If i would Whitelist the Domain of the HLS Stream (in Adobe Cordova) theoretically it should work?

Or are there any additoonal CrossDomain Requests i have to watch out for, in this lib?

thx in advance!

gkatsev commented 8 years ago

Both the manifests and ts segments are loaded in over XHR. Normal browsers do not allow you to do XHR from the file:// protocol or to file:// protocols, I do not know about Cordova.

michael-riha commented 8 years ago

it is the same in Cordova, but i guess if we add the video-CDN's Domain to the CORS-Whitelist it might work. THX a lot!