shaka-player-react icon indicating copy to clipboard operation
shaka-player-react copied to clipboard

DRM content

Open TDUser91 opened this issue 1 year ago • 1 comments

how do I play drm streaming content using this library ? Thank you

example dataSource:

url : https://storage.googleapis.com/shaka-demo-assets/angel-one-widevine/dash.mpd
license: https://cwip-shaka-proxy.appspot.com/no_auth

TDUser91 avatar Jul 19 '23 13:07 TDUser91

@TDUser91 you can go with this way

import React, { useRef, useEffect } from 'react'
import ShakaPlayer from 'shaka-player-react'
import 'shaka-player/dist/controls.css'

const Player = () => {
const shakaRef = useRef(null)
const drmLicenseUrl = 'https://cwip-shaka-proxy.appspot.com/no_auth'
const { player, ui, videoElement } = shakaRef?.current

useEffect(()=>{
if (drmLicenseUrl !== '') {
          player?.configure({
            drm: {
              servers: {
                'com.widevine.alpha': drmLicenseUrl,
              },
            },
            })
            }
},[)

            
          
return(
 <ShakaPlayer
        autoPlay
        ref={shakaRef}
        src={'https://storage.googleapis.com/shaka-demo-assets/angel-one-widevine/dash.mpd'}
      />)
            }
    export default Player;

pluvd7j avatar Jan 02 '24 11:01 pluvd7j