videojs / videojs-contrib-hls

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

Videoplayer sometimes falsely returns ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) #1432

Closed cathmer closed 5 years ago

cathmer commented 6 years ago

Description

I have a strange issue, where I try to play video from a server (I'm using https://github.com/kaltura/nginx-vod-module to serve HLS video), and sometimes it works, and sometimes it doesn't. I use a datetimepicker to select the date and time from which to show video. This date and time is used in the request URL for the video, and the VOD module of Nginx takes care of creating and serving the correct video.

Usually, the first time I select a time and try to play the video, it works (if there is video present on the server ofcourse). But when I then pick a different time close to the original time, the video player gives the following error: 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.

When I refresh the page and then select the exact same time which just failed, it does work, meaning there is video present to show.

When I check the access logs of Nginx, I can see that when the video works it immediately downloads 4 segments and starts playing. But when the video fails, it only downloads the first segment and then stops for some reason and gives the above error. I have no idea why this error happens. Any ideas?

I use the following lines to play the video everytime new video is selected:

player.src({
    src: url,
    type: 'application/x-mpegURL'
});
player.play();

where url is a custom url dependent on the selected time.

Results

Expected

I expect the video to work, because I can see on the server that it is properly serving the correct content.

Error output

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.

Additional Information

videojs-contrib-hls version

what version of videojs-contrib-hls does this occur with? videojs-contrib-hls x.y.z

videojs version

what version of videojs does this occur with? @version 5.14.1

Browsers

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

Platforms

what platforms are affected? please include operating system and version or device and version for each

forbesjo commented 6 years ago

Would you be able to provide an example jsbin of your player for debugging? Here's a template (http://jsbin.com/vokipos/8/edit?html,output)