Skip to content

Commit

Permalink
docs(react-native): remove usage of useLocalVideoStream and old webrtc (
Browse files Browse the repository at this point in the history
  • Loading branch information
santhoshvai authored Aug 31, 2023
1 parent 6a7e028 commit 9ed68de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ There are many possibilities and the [call and participant state](../../core/cal
#### Creating a UI to watch a livestream​

The layout is built using standard React Native components.
The `RTCView` component is provided by `react-native-webrtc` library. You can use it for rendering the local and remote video.
The `RTCView` component is provided by `@stream-io/react-native-webrtc` library. You can use it for rendering the local and remote video.
The `useIncallManager` hook is used to automatically route audio to speaker devices as relevant for watching videos.

#### Backstage mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ const { status } = useCameraState(); // status returns enabled, disabled or unde

### Show Video Preview

We can get the video stream from the camera using the utility hook `useLocalVideoStream` and show it using the `RTCView` component from `react-native-webrtc` library:
We can get the video stream from the camera using the media stream from the `call.camera` object and show it using the `RTCView` component from `@stream-io/react-native-webrtc` library:

```tsx
import { RTCView } from 'react-native-webrtc';
import { useLocalVideoStream } from '@stream-io/video-react-native-sdk';
import { RTCView } from '@stream-io/react-native-webrtc';
const call = useCall();

const localVideoStream = useLocalVideoStream();
const localVideoStream = call?.camera.state.mediaStream;

return <RTCView streamURL={localVideoStream?.toURL()} />;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ These hooks make sure, that the information about call metadata or call members

### Video Input Preview

We can show the local video preview in the Lobby view, before joining the call to check if everything is fine with your video. To do that you can take the use of `useLocalVideoStream` and `useConnectedUser` hooks to get the local participant's video stream and user info.
We can show the local video preview in the Lobby view, before joining the call to check if everything is fine with your video. We can get the video stream from the camera using the media stream from the `call.camera` object and show it using the `RTCView` component from `@stream-io/react-native-webrtc` library. And by using the `useConnectedUser` hook we can get the user info.

To show the Video preview, we can use the [`RTCView`](https://github.com/react-native-webrtc/react-native-webrtc/blob/master/src/RTCView.ts) component from [`react-native-webrtc`](https://github.com/react-native-webrtc/react-native-webrtc).
To show the Video preview, we can use the [`RTCView`](https://github.com/GetStream/react-native-webrtc/blob/master/src/RTCView.ts) component from [`@stream-io/react-native-webrtc`](https://github.com/GetStream/react-native-webrtc).

<ImageShowcase
items={[
Expand All @@ -91,19 +91,19 @@ import {
Avatar,
StreamVideoParticipant,
useConnectedUser,
useLocalVideoStream,
useCall,
useCallStateHooks,
} from '@stream-io/video-react-native-sdk';
import React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import { RTCView } from 'react-native-webrtc';
import { RTCView } from '@stream-io/react-native-webrtc';

export const LocalVideoRenderer = () => {
const localVideoStream = useLocalVideoStream();
const call = useCall();
const localVideoStream = call?.camera.state.mediaStream;
const connectedUser = useConnectedUser();
const { useCameraState } = useCallStateHooks();
const { status: cameraStatus } = useMicrophoneState();
const isVideoAvailable = !!localVideoStream && cameraStatus === 'enabled';
const { status: cameraStatus } = useCameraState();

const connectedUserAsParticipant = {
userId: connectedUser?.id,
Expand All @@ -114,7 +114,7 @@ export const LocalVideoRenderer = () => {
return (
<View style={styles.videoView}>
<View style={styles.topView} />
{isVideoAvailable ? (
{cameraStatus === 'enabled ? (
<RTCView
streamURL={localVideoStream?.toURL()}
objectFit="cover"
Expand Down

0 comments on commit 9ed68de

Please sign in to comment.