Adding DRM Externally
The example code shows how to use the LuraPlayer to play encrypted content protected with Digital Rights Management (DRM) systems. LuraPlayer currently supports fairplay, widevine, and playready.
For each DRM system, the license URL and other necessary properties must be provided.
- For fairplay, the licenseUrl and fairplayCertificate properties must be specified.
- For widevine, only the licenseUrl property must be specified.
- For playready, only the licenseUrl property must be specified.
The provided URLs will be used by the LuraPlayer to obtain the necessary licenses and certificates required to decrypt and play the encrypted content.
import React, { useRef } from "react";
import { LuraPlayer, LuraPlayerProps } from "lura-react-native-core";
export default function MySampleComponent() {
const playerRef = useRef<LuraPlayer>(null);
const config = {
url: "VIDEO_URL_OF_THE_ENCRYPTED_CONTENT",
licenseUrl: "YOUR_DRM_LICENSE_URL",
fairplayCertificate: "YOUR_FAIRPLAY_CERTIFICATE",
};
return (
<View>
<LuraPlayer ref={playerRef} config={config} />
</View>
);
}