luo qiang
luo qiang

Reputation: 1

I get an error: VIDEOJS: ERROR: (CODE:0 MEDIA_ERR_CUSTOM) When I play video using video.js

I could play an rtmp video stream using video.js before, but today suddenly I can't play. The console throws an error:

VIDEOJS: ERROR: (CODE: 0 MEDIA_ERR_CUSTOM) MediaError {code: 0, message: ""}. 

What caused MEDIA_ERR_CUSTOM? How to fix it?

The play source is no problem, and VLC media player can play normally with it.

src: "rtmp://192.168.135.217:10064/live/res=37.10000000001311000004.IV.0.0"
type: "rtmp/flv"

            <video
              id="my-video"
              ref={this.video}
              width="800px"
              height="500px"
            >
              <track kind="captions" />
              <source src={url} type={type} />
            </video>

Upvotes: 0

Views: 1490

Answers (2)

John Wilfred
John Wilfred

Reputation: 169

If you're using Flash as a fallback or just using Flash and having this specific error:

VIDEOJS: ERROR: (CODE:0 MEDIA_ERR_CUSTOM)  MediaError {type: "FLASHLS_ERR_CROSS_DOMAIN", origin: "flash", message: ""}

Then you need to add or configure your crossdomain.xml file into this:

<?xml version="1.0"?>
<cross-domain-policy>
    <allow-access-from domain="*.mycompany.com" />
    <allow-access-from domain="*.speedtest.net" />
</cross-domain-policy>

If it's the first time adding it on your app, this file goes in the root of the document folder on the server you want to allow access. Ex: http://speedtest.mycompany.com/crossdomain.xml

and it should be added on your routing:

@web('/crossdomain.xml', 'template/crossdomain.xml')
def index(request): pass

More info about crossdomain.xml here: https://support.ookla.com/hc/en-us/articles/234575708-What-is-crossdomain-xml-and-why-do-I-need-it-

Upvotes: 0

Phil
Phil

Reputation: 1061

Check your dev tools network tab to see if the media is being requested and returned? A few things to troubleshoot:

  1. Ensure the video URL is correct and that the file is publicly accessible
  2. Ensure that your CORS policy permits the domain you're requesting from
  3. If using a flash fallback, you will need a crossdomain.xml file to permit the domain (similar to CORS) - be sure to clear your cache after correcting this as even a hard refresh may not reload it

Upvotes: 0

Related Questions