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 { useLivestream } from '@huddle01/react/hooks';
  
  const App = () => {
    const { startLivestream,stopLivestream, isStarting, inProgress isStopping, error } = useLivestream();
 
    if(inProgress) return (<div>...loading</div>)
  
    return (
      <div>
        <button 
          disabled={!startLivestream.isCallable} 
          onClick={startLivestream}
        >
          START_LIVESTREAM
        </button>
 
        {isStarting ? "live stream is starting": error} 
 
 
        <button disabled={!stopLivestream.isCallable} onClick={stopLivestream}>
          STOP_LIVESTREAM
        </button>
      </div>
    );
  };
 
 
 
 
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.