Skip to main content

Usage

Before using the player, initialize the PRESTOplay SDK with valid license keys. The Sdk.initialize method should be called once during the application's lifecycle. Pass valid license keys associated with your application ID. Please contact support for more information on how to obtain the license keys. Below is a complete example of how to initialize the SDK and play a stream in an app:

import React from 'react';
import {SafeAreaView} from 'react-native';
import {
Sdk,
ContentType,
PlayerProvider,
PlayerView
} from '@castlabs/react-native-prestoplay';

Sdk.initialize({
licenseKey: {
android: 'my-android-key',
iOS: 'my-ios-key',
tvOS: 'my-tvos-key',
},
});

export default function App() {
const playerConfig = {
autoPlay: true,
source: {
url: 'https://demo.cf.castlabs.com/media/prestohls/master.m3u8',
type: ContentType.Hls,
},
};
return (
<SafeAreaView>
<PlayerProvider playerConfig={playerConfig}>
<PlayerView/>
</PlayerProvider>
</SafeAreaView>
);
}