webpack import videojs-contrib-hls will not register hls source handler for html5 tech, that cause media_err_src_not_supported
Sorry, i do not know whether or not it is vue-video-player issue or video-contrib-hls itself. I can not use vue-video-player well with hls, so i report bug here also.
When i use webpack to bundle videojs and contrib-hls, the video-contrib-hls will not register sourceHandlers of "Html5" tech. Please see the video.js code here: ` _Tech.selectSourceHandler = function (source, options) { var handlers = _Tech.sourceHandlers || []; var can = void 0;
for (var i = 0; i < handlers.length; i++) {
can = handlers[i].canHandleSource(source, options);
if (can) {
return handlers[i];
}
}
`
So, if i try to play m3u8 video in chrome, the console will printed out: " VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media " If i use videojs and videojs-contrib-hls with a tag in html, the contrib-hls will register sourceHandlers of "Html5" tech right. Everything works fine.
Vue.js version and component version
V2.5.4
Reproduction Link
- Sorry, it is a generic build and run question, no easy for jsbin
Steps to reproduce
- use webpack bundle including video.js and video.contrib-hls
- play a m3p8 using video.js
What is Expected?
should play video
What is actually happening?
There will be following error in console: ' VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media '
i pasted the additional info here from videojs bug report also: So, can you explain when the video-contrib-hls will register HlsSourceHandler to html5 tech a little bit? The issue is clear: contrib-hls will not register rightly its hls source handler to html5 tech, so videojs can not find a capable source handling m3u8, that will cause 'VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media' error. If we have some glue on when and how contrib-hls register its hls source handler, we can fix it or workaround it. thanks~!
I think it is the issue of video.js. I notice that it works well when using version 6.7.3, but the same error as yours will be printed out when using 6.8.0. So I just made it back to 6.7.3, then everything ran well.
how to change vue-video-player‘s package.json ? create a new npm pacakge?
create a new npm pacakge?