VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media.

Description

I init a videojs instance and when I get a new source, I want to change the source. Unfortunately �I get an error.

Steps to reproduce

here are an example in jsbin.
https://jsbin.com/qusiwik/edit?html,output
1.init a videojs instance
2.change the source

Results

Expected

change video source

Actual && Error output

source change failed and i get an error
image

Additional Information

versions

videojs

v7.3.0

browsers

chrome(I haven’t tried in other browser)

Do I use wrong function? waiting for your anwser~~thx

1 possible answer(s) on “VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media.

  1. Unfortunately, due to the way that Video.js works currently, if a type is not given and it cannot figure the type out from the URL, it cannot play it back. Adding a type as a source object (or working around it by adding #.mp4 to the url makes it work. The source object approach is the preferred one.

    player.src({
      src: 'http://img-ys011.didistatic.com/static/didiglobal/do1_pcUZZjSG7vFlMbdr8fA6',
      type: 'video/mp4'
    });
    player.src('http://img-ys011.didistatic.com/static/didiglobal/do1_pcUZZjSG7vFlMbdr8fA6#.mp4')

    Hope this helps