1
1
import * as React from 'react' ;
2
-
3
2
import {
4
3
StyleSheet ,
5
4
View ,
@@ -14,14 +13,16 @@ import {
14
13
TrackReferenceOrPlaceholder ,
15
14
VideoTrack ,
16
15
isTrackReference ,
16
+ registerGlobals ,
17
17
} from '@livekit/react-native' ;
18
-
19
18
import { Track } from 'livekit-client' ;
20
19
21
- // !! Note !!
22
- // This sample hardcodes a token which expires in 2 hours.
23
- const wsURL = "%{wsURL}%"
24
- const token = "%{token}%"
20
+ // registerGlobals must be called prior to using LiveKit.
21
+ registerGlobals ( ) ;
22
+
23
+ // Fill in these values with your own url and token.
24
+ const wsURL = "wss://www.example.com"
25
+ const token = "your-token-here"
25
26
export default function App ( ) {
26
27
27
28
// Start the audio session first.
@@ -42,6 +43,7 @@ export default function App() {
42
43
token = { token }
43
44
connect = { true }
44
45
options = { {
46
+ // Use screen pixel density to handle screens with differing densities.
45
47
adaptiveStream : { pixelDensity : 'screen' } ,
46
48
} }
47
49
audio = { true }
@@ -53,11 +55,11 @@ export default function App() {
53
55
} ;
54
56
55
57
const RoomView = ( ) => {
56
- // Get all camera tracks
58
+ // Get all camera tracks.
57
59
const tracks = useTracks ( [ Track . Source . Camera ] ) ;
58
60
59
61
const renderTrack : ListRenderItem < TrackReferenceOrPlaceholder > = ( { item} ) => {
60
- // Render using the VideoTrack component
62
+ // Render using the VideoTrack component.
61
63
if ( isTrackReference ( item ) ) {
62
64
return ( < VideoTrack trackRef = { item } style = { styles . participantView } /> )
63
65
} else {
0 commit comments