Demo THEOplayer

Using custom error messages

This page demonstrates how you can set a default error message.


When you assign an unavailable stream to THEOplayer

You will see the following error message:



However, you might want to display another error to your viewers:



There are -generally speaking- two approaches to achieve this:

  1. Localization
  2. error event

1. Localization

The Localization approach is useful when you know which error message you want to map (or translate). Localization is also the fastest method to display custom error messages.

There's a Localization example at, so read up!
If you want to extend this localization example to also map errors, you need to provide the default THEOplayer error message as a key, and your custom error message as a value. For example:

var player = new THEOplayer.Player(videoContainer, {
libraryLocation: '',
ui: {
language: 'langCode',
languages: { 'langCode':
"Could not load the manifest file. Make sure the source is set correctly and that CORS support is enabled.": "Your stream is currently unavailable. Please try again.",
"Play": "Reproducir",
"Pause": "Pausa",

This approach is advised when you want to map a specific set of common errors to custom messages.

2. error event

The error event allows you to catch errors. In the event-handler of an error, you can overlay custom elements on top of THEOplayer. For example:

player.addEventListener('error', function(e) {
if (e.error === "Could not load the manifest file. Make sure the source is set correctly and that CORS support is enabled.") {
// display custom error message
// ...

// or overwrite existing content
var errorMessage = player.element.parentNode.querySelector('.vjs-error-display .vjs-modal-dialog-content');
if (errorMessage) {
errorMessage.innerText = "Your stream is currently unavailable. Please try again.";

This approach is advised if you want to create a truly custom experience, and you don't want to be limited by the THEOplayer API.

Still wasting time debugging video playback problems?

Welcome to cutting-edge video, delivered efficiently and on any platform. We think you're going to like it.