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

Created on 20 Nov 2018  ·  8Comments  ·  Source: videojs/video.js

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

Most helpful comment

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

All 8 comments

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

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

it works~thx

You're welcome.

This should be documented somewhere...

I tried to do this but now my video stops playing after one second of play. Please suggest something that I can do

"video.js": "^6.13.0"
"videojs-contrib-hls.js": "^3.2.0"
"vue-video-player": "^5.0.2"

我已解决此问题

It's working at this link, But why is it not working with the youtube link or google drive link?

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

It's working at this link, But why is it not working with the youtube link or google drive link?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeonghwaYoo picture jeonghwaYoo  ·  3Comments

dingyaguang117 picture dingyaguang117  ·  4Comments

TheKassaK picture TheKassaK  ·  3Comments

uikoo9 picture uikoo9  ·  4Comments

onigetoc picture onigetoc  ·  4Comments