videojs-player icon indicating copy to clipboard operation
videojs-player copied to clipboard

webpack import videojs-contrib-hls will not register hls source handler for html5 tech, that cause media_err_src_not_supported

Open kidsit opened this issue 8 years ago • 4 comments

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

  1. use webpack bundle including video.js and video.contrib-hls
  2. 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 '

kidsit avatar Apr 21 '18 14:04 kidsit

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~!

kidsit avatar Apr 21 '18 14:04 kidsit

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.

FrankCheungDev avatar May 11 '18 19:05 FrankCheungDev

how to change vue-video-player‘s package.json ? create a new npm pacakge?

5201314999 avatar Dec 12 '18 06:12 5201314999

create a new npm pacakge?

laluxgp avatar Feb 05 '21 05:02 laluxgp