DRM

TV SDK에서 DRM으로 보호된 콘텐츠를 재생하는 방법을 안내합니다.

Android TVtvOS
DRM은 시뮬레이터/에뮬레이터에서 동작하지 않습니다. 실기기 테스트가 필수입니다.

플랫폼별 DRM

플랫폼DRM엔진
Android TVWidevine (com.widevine.alpha)ExoPlayer
tvOSFairPlay (com.apple.fps)AVPlayer

방식 1: 웹 SDK 호환 DRM 키

SDK가 플랫폼에 따라 자동으로 적합한 DRM을 선택합니다. Android TV는 Widevine, tvOS는 FairPlay를 사용합니다.

<VpePlayer
    accessKey="YOUR_ACCESS_KEY"
    options={{
        playlist: [{
            drm: {
                'com.widevine.alpha': {
                    src: 'https://example.com/manifest.mpd',
                    licenseUri: 'https://license-server.com/widevine',
                    licenseRequestHeader: {
                        'pallycon-customdata-v2': 'DRM_TOKEN',
                    },
                },
                'com.apple.fps': {
                    src: 'https://example.com/index.m3u8',
                    certificateUri: 'https://license-server.com/cert',
                    certificateRequestHeader: {
                        'pallycon-customdata-v2': 'DRM_TOKEN',
                    },
                    licenseUri: 'https://license-server.com/fairplay',
                    licenseRequestHeader: {
                        'pallycon-customdata-v2': 'DRM_TOKEN',
                    },
                },
            },
            poster: 'https://example.com/poster.jpg',
            description: { title: 'DRM 영상' },
        }],
    }}
    onBack={() => navigation.goBack()}
/>

방식 2: react-native-video 직접 DRM 형식

react-native-video의 DRM 형식을 직접 사용할 수도 있습니다.

FairPlay (tvOS)

<VpePlayer
    accessKey="YOUR_ACCESS_KEY"
    options={{
        playlist: [{
            file: 'https://example.com/video.m3u8',
            drm: {
                type: 'fairplay',
                licenseServer: 'https://license-server.com/fairplay',
                certificateUrl: 'https://license-server.com/cert',
                headers: { 'pallycon-customdata-v2': 'DRM_TOKEN' },
            },
        }],
    }}
    onBack={() => navigation.goBack()}
/>

Widevine (Android TV)

<VpePlayer
    accessKey="YOUR_ACCESS_KEY"
    options={{
        playlist: [{
            file: 'https://example.com/video.mpd',
            drm: {
                type: 'widevine',
                licenseServer: 'https://license-server.com/widevine',
                headers: { 'pallycon-customdata-v2': 'DRM_TOKEN' },
            },
        }],
    }}
    onBack={() => navigation.goBack()}
/>

Secure Token

token 속성으로 재생 소스에 Secure Token을 적용하여 OneTimeUrl을 지원할 수 있습니다. 재생 중 토큰 갱신도 가능합니다.

const playerRef = useRef<PlayerHandle>(null);

<VpePlayer
    ref={playerRef}
    accessKey="YOUR_ACCESS_KEY"
    options={{
        playlist: [{
            file: 'https://example.com/video.m3u8',
        }],
        token: 'token=st=1675320871~exp=1675320901~acl=....',
    }}
    onBack={() => navigation.goBack()}
/>

// 재생 중 토큰 갱신
playerRef.current?.tokenChange('NEW_TOKEN_VALUE');
TV SDK