useLivestream

useLivestream

useLivestream hook allows you to use following methods & states.

NameType
startLivestream()Functionstarts live-streaming the web app on the given sourceUrl
stopLivestream()Functionstops the live-stream on the web app
isStartingbooleanstate whether the livestream has started or not
inProgressbooleanstate whether the livestream is in progress
isStoppingbooleanstate whether the livestream has stopped or not
datadatadata of the livestream
errorstringgives the error message

Sample code

 
 import {Button, View, Text} from 'react-native';
 import {useLivestream} from '@huddle01/react-native/hooks';
  
  const App = () => {
    const { startLivestream, stopLivestream, isStarting, inProgress isStopping, error } = useLivestream();
 
    if(inProgress) return (<View><Text>Loading...</Text></View>)
  
    return (
      <View>
         <View style={styles.button}>
          <Button
            title="START_LIVESTREAM"
            disabled={!startLivestream.isCallable} 
            onPress={startLivestream}
          />
        </View>
 
        {isStarting ? <Text>"live stream is starting"</Text>: error} 
 
        <View style={styles.button}>
          <Button
            title="STOP_LIVESTREAM"
            disabled={!stopLivestream.isCallable}
            onPress={stopLivestream}
          />
        </View>
      </View>
    );
  };
 
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2022 Graphene 01, Inc. All Rights Reserved.