Usage
Before using the CLVideo
component, you need to initialise it with licence keys.
The CLVideo.initialize
method should be called once during the lifecycle of the application.
Licence keys are associated with your application ID.
Please contact support for more information on how to obtain licence keys.
import {CLVideo} from '@castlabs/react-native-prestoplay';
import React, {useState, useEffect, useMemo} from 'react';
import {SafeAreaView} from 'react-native';
export default function App() {
const [sdkInitialized, setSdkInitialized] = useState(false);
useEffect(() => {
const baseConfig = {
licenseKey: {
android: 'my-android-key',
iOS: 'my-ios-key',
tvOS: 'my-tvos-key',
},
};
CLVideo.initialize(baseConfig).then(() => {
setSdkInitialized(true);
});
}, []);
const playerConfig = useMemo(() => {
return {
autoPlay: true,
source: 'https://demo.cf.castlabs.com/media/prestohls/master.m3u8',
};
}, []);
return (
<SafeAreaView>
{sdkInitialized && <CLVideo media={playerConfig} />}
</SafeAreaView>
);
}