Video.js: Question: how to customize media error messages without plugins?

Created on 3 Nov 2017  路  3Comments  路  Source: videojs/video.js

I need to customize a message like The media could not be loaded, either because the 鈥k failed or because the format is not supported.

I tried to access this code:
https://github.com/videojs/video.js/blob/8f16de277827f77ddd65038bb17d1d7cb88861ee/src/js/media-error.js#L106
To simply override it. But didn't find the way to do it.

I'm aware of https://github.com/brightcove/videojs-errors, but can I'm not sure I need such a complex plugin. Because I just need to customize single message text.

Most helpful comment

If you're looking to translate the messages, one of the existing translations may be what you're looking for, e.g. http://vjs.zencdn.net/6.2.8/lang/fr.js

Otherwise you can override the text by setting a new "English" translation:

videojs.addLanguage('en', {"The media could not be loaded, either because the server or network failed or because the format is not supported.": "Could not load the video."});

All 3 comments

If you're looking to translate the messages, one of the existing translations may be what you're looking for, e.g. http://vjs.zencdn.net/6.2.8/lang/fr.js

Otherwise you can override the text by setting a new "English" translation:

videojs.addLanguage('en', {"The media could not be loaded, either because the server or network failed or because the format is not supported.": "Could not load the video."});

@mister-ben Amazing! It works. thank you. I was looking for override "English".

If you want to just change the text for the error then you should go to video.min.js file and then search that specific error in video.min.js and change the error text. Bear me if its late or it doesn't solve your problem

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aagiulian picture aagiulian  路  3Comments

shivamg705 picture shivamg705  路  4Comments

jeonghwaYoo picture jeonghwaYoo  路  3Comments

zhulduz picture zhulduz  路  3Comments

0xsven picture 0xsven  路  3Comments