Error response

Prev Next

Available in Classic and VPC

The error response explains how to edit script code and apply custom messages to the playback sources through the error event.

Note

You can view the error codes on the Media analytics management page when subscribing the Media Analytics service along with the Video Player Enhancement service.

JS Error event information

The function calling the player can call error codes and messages when detecting the event with the player.on("error", (err) => {}); code.

Note

The error codes are sent to the error code list provided by the Video Player Enhancement service. For more information, see the error code.

Examples are as follows:

function createPlayer(id) {
    let player = new ncplayer('video', {
        { 
            file:"http://example.com/myVideo.mp4",
            poster:"http://example.com/myVideoThumb.png" 
        },
    });
    
    player.on("error", (err) => {
        const error_code = err.code;
        switch (error_code) {
            case "E0001":
                console.log("E0001 - ACCESS DENIED");
                console.log ("Invalid access / Occurs when an incorrect option value is sent", err);
                break;
            case "E0002":
                console.log("E0002 - NOT AUTHORIZED");
                console.log ("Unauthorized video playback / Occurs when player authentication fails due to bad request", err);
                break;
            case "E0003":
                console.log("E0003 - NETWORK ERROR");
                console.log ("Authentication failed / Occurs due to a network connection problem", err);
                break;
            case "E0004":
                console.log("E0004 - CANNOT PLAY");
                console.log ("Video playback impossible / Occurs when failing to play a video file", err);
                break;
            case "E0005":
                console.log("E0005 - LICENSE IS INVALID");
                console.log ("Invalid license / Occurs when the license expires", err);
                break;
            case "E0006":
                console.log("E0006 - LIMIT DENIED");
                console.log ("Exceed monthly basic call / Occurs when the monthly usage limit for a free player has been reached", err);
                break;
            default:
                break;
        }
    });
}

Retry environment settings when error occurs

Through the retry settings of the player, you can customize the settings of maximum amount of retry attempts and maximum delay time before the player responds to an error.

Note

Default values are as follows:

  • Additional video playback attempts when the player is initialized: default value is 3 times maximum, with 5-second intervals
  • Additional video playback attempts when Live/VOD is interrupted: default value is 3 times maximum, with 5-seconds intervals
  • The following is an example of a new definition through Retry option:
new ncplayer('video', {
    playerlist:[
        {
            file:"https://dobdd7vj3864.edge.naverncp.com/hls/47NWZgkwsKFkPIU1tix9Zw__/endpoint/sample/example.mp4.smil/master.m3u8",
            poster:"https://2ardrvaj2252.edge.naverncp.com/endpoint/sample/221027_NAVER_Cloud_intro_Long_ver_01.jpg",
        },
    ],
        retry:{
            maxRetry:10, //maximum amount of retry attempts
            interval:5000, //delay time per retry attempt (ms)
        },
    },
);
Option Type Default value Description
retry Object
retry.maxRetry Int 3 Amount of repeated attempts
retry.interval Int 5000 Delay time for repeated attempts (ms)

Error screen override (Override)

Customers can change and implement the default error screen with the desired code.
When overriding the error screen, it can be implemented through the player overlay, maintaining the pause at the last playback position as in the following modified screen:
image-EFN2HNB7

Examples are as follows:

// Video (MP4)
const player = new ncplayer('video', {
    playlist: [
        {
            file: 'https://CDNdomain/example_video_01.mp4',
            poster: 'https://CDNdomain/example_image_01.png',
        }
    ],
    override:{
        error(err){
            console.log('player error :', err);
            // Customer error screen function implemented
            // \<example> documnet.getElementById('error').style.display = 'block';
        },
    }
});

Error code

The following are the error codes provided by Video Player Enhancement Service:

Error number Error code Error message Description
E0001 ACCESS DENIED Invalid access. Occurs when wrong option values are sent, video playback is unavailable
E0002 NOT AUTHORIZED You are not authorized to play this video. Occurs when player authentication fails due to bad request
E0003 NETWORK ERROR Network connection is unstable. Occur when player authentication fails due to a network problem
E0004 CANNOT PLAY VIDEO Unable to play video. Occurs when failing to play a video
E0005 LICENSE IS INVALID The license is invalid. Occurs when the player license expires, video playback is unavailable
E0006 LIMIT DENIED The monthly basic call count has been exceeded. Occurs when the monthly usage limit for a free player has been reached, video playback is unavailable