@@ -100,7 +100,7 @@ Copy the `ZegoExpressManager` folder、 `pages` folder、`img` folder and `App.j
100
100
101
101
` ` ` json
102
102
" dependencies" : {
103
- " zego-express-engine-reactnative" : " ^0.17.3 "
103
+ " zego-express-engine-reactnative" : " ^0.18.0 "
104
104
}
105
105
` ` `
106
106
# ## Turn off some classes's confusion
@@ -152,7 +152,7 @@ You need to grant the network access, camera, and microphone permission to make
152
152
# ## Method call
153
153
154
154
The calling sequence of the SDK interface is as follows:
155
- createEngine --> onRoomUserUpdate、onRoomUserDeviceUpdate、onRoomTokenWillExpire --> joinRoom --> setLocalVideoView/setRemoteVideoView --> leaveRoom
155
+ createEngine --> onRoomUserUpdate、onRoomUserDeviceUpdate、onRoomTokenWillExpire、onRoomExtraInfoUpdate、onRoomStateUpdate --> joinRoom --> setLocalVideoView/setRemoteVideoView -- > enableCamera、enableMic --> leaveRoom
156
156
157
157
# ### Create engine
158
158
@@ -163,7 +163,7 @@ const profile = {
163
163
appID: config.appID,
164
164
scenario: ZegoScenario.General,
165
165
} as ZegoEngineProfile;
166
- ZegoExpressManager.instance (). createEngine(profile);
166
+ ZegoExpressManager.createEngine(profile);
167
167
` ` `
168
168
169
169
# ### Register related callbacks
@@ -180,6 +180,12 @@ ZegoExpressManager.instance().onRoomUserDeviceUpdate((updateType, userID, roomID
180
180
ZegoExpressManager.instance().onRoomTokenWillExpire((roomID, remainTimeInSecond) => {
181
181
// Do something...
182
182
});
183
+ ZegoExpressManager.instance().onRoomExtraInfoUpdate((roomExtraInfoList) => {
184
+ // Do something...
185
+ })
186
+ ZegoExpressManager.instance().onRoomStateUpdate((state) => {
187
+ // Do something...
188
+ })
183
189
```
184
190
185
191
#### Join room
@@ -188,16 +194,25 @@ When you want to communicate with audio and video, you need to call the join roo
188
194
189
195
ZegoMediaOptions enumeration can be found in ZegoExpressManager/index.entity.ts.
190
196
191
- 1 . call scene: [ZegoMediaOptions.AutoPlayVideo, ZegoMediaOptions.AutoPlayAudio, ZegoMediaOptions.PublishLocalAudio, ZegoMediaOptions.PublishLocalVideo], the default is this scenario
192
- 2 . Live scene - host: [ZegoMediaOptions.AutoPlayVideo, ZegoMediaOptions.AutoPlayAudio, ZegoMediaOptions.PublishLocalAudio, ZegoMediaOptions.PublishLocalVideo]
193
- 3 . Live scene - audience:[ZegoMediaOptions.AutoPlayVideo, ZegoMediaOptions.AutoPlayAudio]
194
- 4 . Chat room - host: [ZegoMediaOptions.AutoPlayAudio, ZegoMediaOptions.PublishLocalAudio]
195
- 5 . Chat room - audience: [ZegoMediaOptions.AutoPlayAudio]
197
+ 1 . Join Live As Host: [ZegoMediaOptions.AutoPlayVideo, ZegoMediaOptions.AutoPlayAudio, ZegoMediaOptions.PublishLocalAudio, ZegoMediaOptions.PublishLocalVideo]
198
+ 2 . Join Live As Audience: [ZegoMediaOptions.AutoPlayVideo, ZegoMediaOptions.AutoPlayAudio]
196
199
197
- The following sample code is an example of a call scenario, options can not be passed by default :
200
+ The following sample code is an example of a call scenario:
198
201
199
202
```typescript
200
- ZegoExpressManager.instance().joinRoom(config.roomID, token, { userID: config.userID, userName: config.userName });
203
+ // Host
204
+ ZegoExpressManager.instance().joinRoom(config.roomID, token, {userID: config.userID, userName: config.userName}, [
205
+ ZegoMediaOptions.PublishLocalAudio,
206
+ ZegoMediaOptions.PublishLocalVideo,
207
+ ZegoMediaOptions.AutoPlayAudio,
208
+ ZegoMediaOptions.AutoPlayVideo
209
+ ]);
210
+
211
+ // Audience
212
+ ZegoExpressManager.instance().joinRoom(config.roomID, token, {userID: config.userID, userName: config.userName}, [
213
+ ZegoMediaOptions.AutoPlayAudio,
214
+ ZegoMediaOptions.AutoPlayVideo
215
+ ]);
201
216
```
202
217
203
218
#### Set video view
@@ -207,18 +222,18 @@ If your project needs to use the video communication function, you need to set t
207
222
** setLocalVideoView:**
208
223
209
224
```tsx
210
- < ZegoTextureView ref= {this.zegoPreviewViewRef }/>
225
+ < ZegoTextureView ref= {this.viewRef 1 }/>
211
226
```
212
227
213
228
```typescript
214
- this.zegoPreviewViewRef = React.createRef();
215
- ZegoExpressManager.instance().setLocalVideoView(findNodeHandle(this.zegoPreviewViewRef .current)) ;
229
+ this.viewRef 1 = React.createRef();
230
+ ZegoExpressManager.instance().setLocalVideoView(findNodeHandle(this.viewRef 1 .current)) ;
216
231
` ` `
217
232
218
233
** setRemoteVideoView:**
219
234
220
235
` ` ` tsx
221
- < ZegoTextureView ref={this.zegoPlayViewRef }/>
236
+ < ZegoTextureView ref={this.viewRef2 }/>
222
237
` ` `
223
238
224
239
` ` ` typescript
@@ -228,17 +243,45 @@ ZegoExpressManager.instance().onRoomUserUpdate(
228
243
if (updateType === ZegoUpdateType.Add) {
229
244
ZegoExpressManager.instance ().setRemoteVideoView(
230
245
userID,
231
- findNodeHandle(this.zegoPlayViewRef .current));
246
+ findNodeHandle(this.viewRef2 .current));
232
247
}
233
248
});
234
249
}
235
250
);
236
251
` ` `
237
252
253
+ # ### Enable camera
254
+
255
+ ` ` ` typescript
256
+ ZegoExpressManager.instance ().enableCamera(enable);
257
+ ` ` `
258
+
259
+ # ### Enable mic
260
+
261
+ ` ` ` typescript
262
+ ZegoExpressManager.instance ().enableMic(enable);
263
+ ` ` `
264
+
238
265
# ### Leave room
239
266
240
267
When you want to leave the room, you can call the leaveroom interface.
241
268
242
269
` ` ` typescript
243
270
ZegoExpressManager.instance().leaveRoom ();
244
271
` ` `
272
+
273
+ # ### Destroy engine
274
+
275
+ When you don' t need to use the SDK anymore, you can uninitialize engine to release the resources.
276
+
277
+ ```typescript
278
+ ZegoExpressManager.destroyEngine();
279
+ ```
280
+
281
+ ## Change Log
282
+
283
+ ### 2022-05-23
284
+
285
+ #### New Features
286
+
287
+ 1. Added live streaming scene with seat
0 commit comments