useScreenShare

useScreenShare

💡

produceScreenShare() method takes list of peerId as an optional argument, by default it will produce video for all peers.

These are the fields which are returned from useVideo hook.

NameType
fetchScreenShare()FunctionFetches screen share stream from user’s display
stopScreenShare()FunctionDisables screen share stream
produceScreenShare(screenShareStream: MediaStream, peerIds?: string[])FunctionStarts sharing user’s screen with other peers in the room
stopProducingScreenShare()FunctionStops sharing user’s screen with other peers in the room
streamMediaStreamScreen share stream
errorstringGives the error message
isScreenShareOnbooleanReturns true if screen share is on

Sample Code

 
import { useScreenShare } from '@huddle01/react/hooks';
 
const App = () => {
  const { fetchScreenShare, produceScreenShare, stopScreenShare, stopProducingScreenShare, stream: screenShareStream  } = useVideo();
 
  return (
    <div>
      
      <button disabled={!fetchScreenShare.isCallable} onClick={fetchVideoStream}>
        FETCH_SCREEN_SHARE
      </button>
 
      <button disabled={!produceScreenShare.isCallable} onClick={() => produceScreenShare(screenShareStream)}>
        PRODUCE_SCREEN_SHARE
      </button>
 
      <button disabled={!stopScreenShare.isCallable} onClick={stopScreenShare}>
        STOP_SCREEN_SHARE
      </button>
 
      <button disabled={!stopProducingScreenShare.isCallable} onClick={stopProducingScreenShare}>
        STOP_PRODUCING_SCREEN_SHARE
      </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.