Content authentication

Prev Next

Available in Classic and VPC

Content authentication describes how to apply Secure Token to play source by editing the script code and how to set MultiDRM.

Secure Token

You can apply Secure Token to playback source and support OneTimeUrl as the token property. Additionally, you can replace Secure Token seamlessly during video playback as the player.tokenChange property.

Note

For more information on Secure Token, see CDN+ user guide.

Examples are as follows:

// Video (MP4)
new ncplayer('video1', {
  autostart: true,
  playlist: [
    {
      file: 'https://CDN도메인/example_video_01.mp4',
    },
  ],
  token: 'token=st=1675320871~exp=1675320901~acl=....', // Secure Token
});

// Token replacement
player.tokenChange('token=st=1675320871~exp=1675320901~acl=....') // Replace with a new token during playback

MultiDRM

You can configure MultiDRM as the playlist.drm property. Examples are as follows:

let player;

document.addEventListener('DOMContentLoaded',  async ()=> {
    await ncplayerDRM('video1',{
        playlist: [
            {
                drm:{
                    'com.apple.fps':{
                        certificateUrl: '{Certificate URL}',
                        licenseUri : 'https://license-global.pallycon.com/ri/licenseManager.do',
                        licenseRequestHeader:{
                            'Content-type': 'application/x-www-form-urlencoded',
                            'pallycon-customdata-v2':'{Token for FairPlay}'
                        },
                        src : '{hls url}'
                    },
                    'com.widevine.alpha':{
                        licenseUri : 'https://license-global.pallycon.com/ri/licenseManager.do',
                        licenseRequestHeader:{
                            'pallycon-customdata-v2':'{Token for Widevine}'
                        },
                        src : '{dash url}'
                    },
                    'com.microsoft.playready':{
                        licenseUri : 'https://license-global.pallycon.com/ri/licenseManager.do',
                        licenseRequestHeader:{
                            'pallycon-customdata-v2':'{Token for PlayReady}'
                        },
                        src : '{dash url}'
                    },
                },
                poster: 'https://nnbkegvqsbcu5297614.cdn.ntruss.com/profile/202207/ae73f3a32b49205fafdc3303c7f0c0b8.png',
                description: {
                    title: "NAVER Cloud",
                    create_at: "2022-12-31",
                    profile_name: "Naver Cloud Platform",
                    profile_image: "https://nnbkegvqsbcu5297614.cdn.ntruss.com/profile/202207/ae73f3a32b49205fafdc3303c7f0c0b8.png
                },
            }
        ],
        controlBtn: {
            play: true,
            fullscreen: true,
            volume: true,
            times: true,
            pictureInPicture: true,
            setting: true,
            subtitle: true
        },
        autostart: false
    });
});
Note
  • To use MultiDRM, you should configure two channels in the VOD Station service to support both HLS and DASH.

  • MultiDRM works only in the HTTPS environment where the SSL/TSL is applied.

  • MultiDRM supports the Widevine, PlayReady, and FairPlay (FPS).

  • Video Player Enhancement service officially supports DoveRunner (formerly PallyCon) MultiDRM.

  • To use the DRM features, you need a contract with an external DRM provider beforehand.

    • DRM type

      • Widevine: DRM technical standard provided by Google. It is encrypted with AES-128 method according to the Common Encryption standard.
      • PlayReady: DRM technical standard provided by Microsoft. It is encrypted with AES-128 method according to the Common Encryption standard.
      • FairPlay: DRM technical standard provided by Apple. It encrypts each HLS segment with Sample-AES method.
    • Support status

      Browser Widevine PlayReady FairPlay
      Internet Explorer (11+ on Windows 8.1+) X O
      (MPEG-DASH)
      X
      Microsoft Edge (Windows 10+) X O
      (MPEG-DASH)
      X
      Chrome (35+ on Windows 7.0+, 57+ on Android 4.4+) O
      (MPEG-DASH)
      X X
      Firefox (47+ on Windows 7.0+) O
      MPEG=DASH
      X X
      Safari (8+ on Mac OS 10.10+, 11.2+ on iOS 11.2+) X X O
      (HLS)
  • The Video Player Enhancement service automatically selects a right playback source (HLS or DASH) based on DRM supported by current browser.

One Click Multi DRM

You can apply DRM connected with the Video Player Enhancement and One Click Multi DRM services.
You should view the Endpoint and Request headers to request FPS Certificate and license issue.

Note
  • Connection with the One Click Multi DRM service is available from the Video Player Enhancement version 1.1.1 or later.
  • For Apple FairPlay, you must create the FPS Certificate and the license signature (X-NCP-APIGW-SIGNATURE-V2) respectively. For more information about signature creation, see Signature creation guide.

FPS certificate requests (For Apple FairPlay)

Endpoint and request headers to request FPS Certificate are as follows:

  • Endpoint

    GET https://multi-drm.apigw.ntruss.com/api/v1/license/fairplay
    
  • Request headers

    Item Required Description
    X-NCP-REGION_CODE O Service Region code in use
    • Korea: KR
    • Singapore: SGN
    • U.S.: USWN
    • Japan: JPN
    • Germany: DEN
    X-NCP-IAM-ACCESS-KEY O Access key ID issued by the portal or Sub Account
    X-NCP-APIGW-TIMESTAMP O Elapsed time represents the milliseconds since January 1, 1970, 00:00:00 Universal Time Coordinated (UTC) and is considered invalid if the time difference with the API Gateway server exceeds 5 minutes
    X-NCP-APIGW-SIGNATURE-V2 O As the signature encrypted with Access Key ID value and Secret Key, HMAC encryption algorithm uses HmacSHA256

License issuance request (For FairPlay, Widevine, and PlayReady)

Endpoint and request headers to request license issuance are as follows:

  • Endpoint

    POST https://multi-drm.apigw.ntruss.com/api/v1/license
    
  • Request headers

    Item Required Description
    X-DRM-TOKEN O An encrypted token value including the necessary data for issuing the One Click Multi DRM license
    X-NCP-REGION_CODE O Service Region code in use
    • Korea: KR
    • Singapore: SGN
    • U.S.: USWN
    • Japan: JPN
    • Germany: DEN
    X-NCP-IAM-ACCESS-KEY O Access key ID issued by the portal or Sub Account
    X-NCP-APIGW-TIMESTAMP O Elapsed time represents the milliseconds since January 1, 1970, 00:00:00 Universal Time Coordinated (UTC) and is considered invalid if the time difference with the API Gateway server exceeds 5 minutes
    X-NCP-APIGW-SIGNATURE-V2 O As the signature encrypted with Access Key ID value and Secret Key, HMAC encryption algorithm uses HmacSHA256

Example

The examples for Apple FairPlay and Widevine/PlayReady to apply One Click Multi DRM are as follows:

  • Apple FairPlay
    document.addEventListener('DOMContentLoaded',  async ()=> {
        await ncplayerDRM('myElement',{
            playlist: [
                {
                    drm:{
                        'com.apple.fps':{
                            certificateUri: '{FPS Certificate Endpoint}',
                            certificateRequestHeader:{
                                'X-NCP-REGION_CODE': 'KR',
                                'X-NCP-IAM-ACCESS-KEY': accessKey,
                                'X-NCP-APIGW-TIMESTAMP': timestamp,
                                'X-NCP-APIGW-SIGNATURE-V2': signature,		 
                            },
                            licenseUri : '{License Endpoint}',
                            licenseRequestHeader:{
                                'X-DRM-TOKEN': '{One Click Multi DRM FPS TOKEN}',
                                'X-NCP-REGION_CODE': 'KR',
                                'X-NCP-IAM-ACCESS-KEY': accessKey,
                                'X-NCP-APIGW-TIMESTAMP': timestamp2,
                                'X-NCP-APIGW-SIGNATURE-V2': signature2,		 
                            },
                            src : 'http://example.com/index.m3u8'
                        }
                    },
                    poster: 'http://example.com/myVideoThumb.png',
                }
            ],
            autostart: true
        });
    });
    
  • Widevine/PlayReady
    document.addEventListener('DOMContentLoaded',  async ()=> {
        await ncplayerDRM('myElement',{
            playlist: [
                {
                    drm:{
                        'com.widevine.alpha':{
                            licenseUri : '{License Endpoint}',
                            licenseRequestHeader:{
                                'X-DRM-TOKEN': '{One Click Multi DRM WIDEVINE TOKEN}',
                                'X-NCP-REGION_CODE': 'KR',
                                'X-NCP-IAM-ACCESS-KEY': accessKey,
                                'X-NCP-APIGW-TIMESTAMP': timestamp2,
                                'X-NCP-APIGW-SIGNATURE-V2': signature2,		 
                            },
                            src : 'http://example.com/index.mpd'
                        },
                        'com.microsoft.playready':{
                            licenseUri : '{License Endpoint}',
                            licenseRequestHeader:{
                                'X-DRM-TOKEN': '{One Click Multi DRM PLAYREADY TOKEN}',
                                'X-NCP-REGION_CODE': 'KR',
                                'X-NCP-IAM-ACCESS-KEY': accessKey,
                                'X-NCP-APIGW-TIMESTAMP': timestamp2,
                                'X-NCP-APIGW-SIGNATURE-V2': signature2,		 
                            },
                            src : 'http://example.com/index.mpd'
                        },
                    poster: 'http://example.com/myVideoThumb.png',
                    }
                }
            ],
            autostart: true
        });
    });
    

DRM test

You can run a DRM test after writing script code.

Note

To run a DRM test, instead of the execution script for default player (ncplayer()), the separate execution script (ncplayerDRM()) should be used.

// Use script code for DRM.
// When the DOM are completely loaded and executed, DRM runs without errors.
document.addEventListener('DOMContentLoaded',  async ()=> {
    await ncplayerDRM('video1',{});
})

Widevine/PlayReady

The script to test Widevine or PlayReady DRM is as follows:

Note
  • The following information is needed to test Widevine or PlayReady DRM:
    • DASH playback source URL
    • Token value for DRM
  • You can test Widevine on the Chrome browser, and PlayReady on the Edge browser on Windows OS.
document.addEventListener('DOMContentLoaded',  async ()=> {
    await ncplayerDRM('video1',{
        playlist: [
            {
                drm:{
                    'com.widevine.alpha':{
                        licenseUri : 'https://license-global.pallycon.com/ri/licenseManager.do',
                        licenseRequestHeader:{
                            'pallycon-customdata-v2':'{Token}'
                        },
                        src : '{dash url}'
                    },
                    'com.microsoft.playready':{
                        licenseUri : 'https://license-global.pallycon.com/ri/licenseManager.do',
                        licenseRequestHeader:{
                            'pallycon-customdata-v2':'{Token}'
                        },
                        src : '{dash url}'
                    },
                },
                poster: 'https://nnbkegvqsbcu5297614.cdn.ntruss.com/profile/202207/ae73f3a32b49205fafdc3303c7f0c0b8.png',
            }
        ],
    });
});

FairPlay(FPS)

The script to test FairPlay DRM is as follows:

Note
  • FairPlay DRM test requires the following information:
    • HLS playback source URL
    • Certificate URL
    • Token value for DRM
  • You can test on the Safari browser on Mac OS.
document.addEventListener('DOMContentLoaded',  async ()=> {
    await ncplayerDRM('video1',{
        playlist: [
            {
                drm:{
                    'com.apple.fps':{
                        certificateUrl: '{Certificate URL}',
                        licenseUri : 'https://license-global.pallycon.com/ri/licenseManager.do',
                        licenseRequestHeader:{
                            'Content-type': 'application/x-www-form-urlencoded',
                            'pallycon-customdata-v2':'{Token}'
                        },
                        src : '{hls url}'
                    },
                },
                poster: 'https://nnbkegvqsbcu5297614.cdn.ntruss.com/profile/202207/ae73f3a32b49205fafdc3303c7f0c0b8.png',
            }
        ],
    });
});