Can I show a backup image/message when the web browser doesn't support the video codec used?

I’m using a codec that isn’t supported in every web browser for demonstration purposes. Can I add a backup poster image to my player so that if people try to load the video from an unsupported browser, I can show a message about which browsers are supported? Thanks!

1 Like

Hey @AndyFrancis
You can rely on the following example to achieve exactly this :

You can extend the example to catch the 1201 - SOURCE_CODEC_OR_FILE_FORMAT_NOT_SUPPORTED warning too.

example :

       var conf = {
            key: 'YOUR KEY HERE',
            events: {
                error: function(errObj) {
                    switch (errObj.code) {
                        case 1208:
                        case 1209:
                        case 1210:
                        case 1400:
                        case 1201:
                            errorHandler();
                            break;
                        default:
                            console.error('error', errObj);
                            break;
                    }
                },
                warning: function(warn) {
                    console.log(warn)
                    switch (warn.code) {
                        case 1201:
                            errorHandler();
                            break;
                        default:
                            console.error('error', warn );
                            break;
                    }
                }
            }
        };

This example is also nice in case you only want to display a custom error message for the corresponding error code.

Let me know in case you have further questions.

2 Likes