Understand Your Viewers' Experience with Player Error Codes
Tech Talk
Version 5.22.0 of the Brightcove Player introduces additional error codes. In the context of our video player, errors are conditions where playback cannot proceed, and getting started again requires some action outside the player itself.
The new error codes will allow you to more easily detect a number of common (and often intentional) situations where playback is blocked. Like all other Brightcove Player errors, you can react to the new error codes by setting up a listener on the player.
// Listen for error events on a player instance:
player.on('error', function() {
// When your listener is invoked, check the error property on the player for details.
var error = player.error();
// Errors have a code and a message
console.log('Uh-oh...', error.code, error.message);
});
The new error codes provide insight into playback failures due to media restrictions and make some common integration problems a bit easier to debug. Here's the full list.
Code | Description |
---|---|
PLAYER_ERR_DOMAIN_RESTRICTED | The player or default video cannot be run on the current page because of domain restriction. |
PLAYER_ERR_IP_RESTRICTED | The default video is disallowed from this user's IP address. |
PLAYER_ERR_GEO_RESTRICTED | The default video is not available in this user's geography. |
VIDEO_CLOUD_ERR_ACCOUNT_NOT_FOUND | The player has been configured with an invalid account ID. |
VIDEO_CLOUD_ERR_RESOURCE_NOT_FOUND | The default playlist ID is invalid. |
VIDEO_CLOUD_ERR_VIDEO_NOT_FOUND | The default video is invalid. |
Note that many of the new error codes only appear for the default video or playlist configured with a player. That is, the video or playlist configured using the videoId
query parameter or data-playlist-id
attribute, for example. If you programmatically fetch videos using the catalog, you will still need to check in the response callback for errors and handle them there.
5.22.0 is available for everyone and is being rolled out for players that receive automatic updates. If you're collecting and analyzing player errors, we hope the new error codes help you understand your audience's experience better (and decrease confusion from your end-users if they encounter an issue).