@byteplus/react-native-rtc 1.0.7-rc.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -316
- package/android/build.gradle +57 -49
- package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/VertcVod.java +5 -0
- package/ios/{VertcHelper.m → core/VertcHelper.m} +5 -2
- package/package.json +1 -1
- package/react-native-rtc.podspec +44 -30
- /package/android/src/{main → live}/java/com/volcengine/reactnative/vertc/live/VertcLive.java +0 -0
- /package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/OESTextureProcessor.java +0 -0
- /package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/VideoAudioProcessor.java +0 -0
- /package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/VodAudioProcessor.java +0 -0
- /package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/VodMock.java +0 -0
- /package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/VodVideoEngineCallbackProxy.java +0 -0
- /package/ios/{RTCHeader.h → core/RTCHeader.h} +0 -0
- /package/ios/{RTCHeader.m → core/RTCHeader.m} +0 -0
- /package/ios/{VertcApiEngine.h → core/VertcApiEngine.h} +0 -0
- /package/ios/{VertcApiEngine.m → core/VertcApiEngine.m} +0 -0
- /package/ios/{VertcHelper.h → core/VertcHelper.h} +0 -0
- /package/ios/{VertcModule.h → core/VertcModule.h} +0 -0
- /package/ios/{VertcModule.m → core/VertcModule.m} +0 -0
- /package/ios/{VertcView.h → core/VertcView.h} +0 -0
- /package/ios/{VertcView.m → core/VertcView.m} +0 -0
- /package/ios/{VertcViewManager.m → core/VertcViewManager.m} +0 -0
package/README.md
CHANGED
|
@@ -138,12 +138,6 @@ const Login = () => {
|
|
|
138
138
|
extras: {
|
|
139
139
|
source_language: room.language,
|
|
140
140
|
},
|
|
141
|
-
roomConfigs: {
|
|
142
|
-
profile: room.roomMode,
|
|
143
|
-
isAutoPublish: room.autoPublish,
|
|
144
|
-
isAutoSubscribeAudio: room.autoSubscribeAudio,
|
|
145
|
-
isAutoSubscribeVideo: room.autoSubscribeVideo,
|
|
146
|
-
},
|
|
147
141
|
});
|
|
148
142
|
|
|
149
143
|
/** Capture local streams */
|
|
@@ -171,316 +165,6 @@ const Login = () => {
|
|
|
171
165
|
|
|
172
166
|
export default Login;
|
|
173
167
|
```
|
|
174
|
-
|
|
175
|
-
## On-Demand Video with Real-Time Guest Interaction Example
|
|
176
|
-
|
|
177
|
-
**We recommend using the latest RTC React Native SDK version in combination with react-native-vod-player SDK v1.2.4.**
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
### RTC Core Definition
|
|
181
|
-
`@/core/index.ts`
|
|
182
|
-
|
|
183
|
-
Based on the rtc core definition in `Basic Example`, add some apis:
|
|
184
|
-
```typescript
|
|
185
|
-
...
|
|
186
|
-
import type { TTVideoEngine } from '@byteplus/react-native-vod-player';
|
|
187
|
-
|
|
188
|
-
class RTCClient {
|
|
189
|
-
|
|
190
|
-
...
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* @brief Start to observe vod player, capture frames from vod player and set stream for external screen stream.
|
|
194
|
-
*/
|
|
195
|
-
startVodPlayerCapture(player: TTVideoEngine) {
|
|
196
|
-
return this.engine?.startVodPlayerCapture(player);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* @brief Stop all vod player observer in rtc.
|
|
201
|
-
* @note Once you invoke this api, you should invoke `startVodPlayerCapture` to observe vod player.
|
|
202
|
-
*/
|
|
203
|
-
stopVodPlayerCapture(player: TTVideoEngine) {
|
|
204
|
-
return this.engine?.stopVodPlayerCapture(player);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
### Main logic page in react-native
|
|
209
|
-
`@/page/vodRtc.ts`
|
|
210
|
-
|
|
211
|
-
```typescript
|
|
212
|
-
import React, {useEffect, useRef, useState} from 'react';
|
|
213
|
-
import fs from 'react-native-fs';
|
|
214
|
-
import {Platform, SafeAreaView, ScrollView} from 'react-native';
|
|
215
|
-
import {Button, Input, Text, Toast, View} from '@ant-design/react-native';
|
|
216
|
-
import {
|
|
217
|
-
NativeViewComponent,
|
|
218
|
-
StreamIndex,
|
|
219
|
-
RenderMode,
|
|
220
|
-
MediaStreamType,
|
|
221
|
-
LocalLogLevel,
|
|
222
|
-
} from '@byteplus/react-native-rtc';
|
|
223
|
-
import {
|
|
224
|
-
createDirectUrlSource,
|
|
225
|
-
type TTVideoEngine,
|
|
226
|
-
} from '@byteplus/react-native-vod-player';
|
|
227
|
-
import {
|
|
228
|
-
launchImageLibrary,
|
|
229
|
-
type ImagePickerResponse,
|
|
230
|
-
} from 'react-native-image-picker';
|
|
231
|
-
import RTCClient from '@/core';
|
|
232
|
-
import { createVeplayer } from '@/core/veplayer';
|
|
233
|
-
import RowItem from '@/components/RowItem';
|
|
234
|
-
import {GlobalStyles} from '@/style';
|
|
235
|
-
|
|
236
|
-
const viewId = 'my-view';
|
|
237
|
-
|
|
238
|
-
const auth = {
|
|
239
|
-
appId: 'Your RTC AppID',
|
|
240
|
-
roomId: 'Your Room ID',
|
|
241
|
-
userId: 'Your User ID',
|
|
242
|
-
token: 'Your RTC Token',
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
const Page = () => {
|
|
246
|
-
const [isViewLoaded, setViewLoaded] = useState<boolean>(false);
|
|
247
|
-
const [filepath, setFilepath] = useState('');
|
|
248
|
-
const hasCaptureRef = useRef(false);
|
|
249
|
-
const playerRef = useRef<TTVideoEngine>();
|
|
250
|
-
|
|
251
|
-
const handleViewLoad = () => {
|
|
252
|
-
setViewLoaded(true);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const handleSelectVideoFile = async () => {
|
|
256
|
-
try {
|
|
257
|
-
const callback = (response: ImagePickerResponse) => {
|
|
258
|
-
if (!response.didCancel && !response.errorCode) {
|
|
259
|
-
const filePath = response.assets?.[0]?.uri;
|
|
260
|
-
if (filePath) {
|
|
261
|
-
setFilepath(filePath);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
launchImageLibrary(
|
|
266
|
-
{
|
|
267
|
-
mediaType: 'video',
|
|
268
|
-
},
|
|
269
|
-
callback,
|
|
270
|
-
);
|
|
271
|
-
} catch {
|
|
272
|
-
Toast.fail('Select media file failed.');
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
const handlePublish = () => {
|
|
277
|
-
RTCClient.publishScreen(MediaStreamType.RTC_MEDIA_STREAM_TYPE_BOTH);
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
const setVideoSource = () => {
|
|
281
|
-
const source = filepath
|
|
282
|
-
? createDirectUrlSource({
|
|
283
|
-
url: filepath,
|
|
284
|
-
cacheKey: filepath,
|
|
285
|
-
})
|
|
286
|
-
: createDirectUrlSource({
|
|
287
|
-
url: 'Your media url, like https://xxxx.mp4',
|
|
288
|
-
cacheKey: 'remote',
|
|
289
|
-
vid: 'remote',
|
|
290
|
-
});
|
|
291
|
-
playerRef.current!.setVideoSource(source);
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
const handlePlay = async () => {
|
|
295
|
-
if (hasCaptureRef.current) {
|
|
296
|
-
playerRef.current!.play();
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
if (!playerRef.current) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
setVideoSource();
|
|
303
|
-
await RTCClient.startVodPlayerCapture(playerRef.current);
|
|
304
|
-
await playerRef.current!.play();
|
|
305
|
-
|
|
306
|
-
RTCClient.publishScreen(MediaStreamType.RTC_MEDIA_STREAM_TYPE_BOTH);
|
|
307
|
-
|
|
308
|
-
hasCaptureRef.current = true;
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
const handleStop = async () => {
|
|
312
|
-
if (hasCaptureRef.current) {
|
|
313
|
-
playerRef.current!.pause();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const handleDestroy = async () => {
|
|
318
|
-
if (!playerRef.current) {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
await RTCClient.stopVodPlayerCapture(playerRef.current);
|
|
322
|
-
hasCaptureRef.current = false;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const initializePlayer = async () => {
|
|
326
|
-
/**
|
|
327
|
-
* @brief It's not necessary to set viewId for vod player.
|
|
328
|
-
* @note You should realize veplayer for youself, refer to @byteplus/react-native-vod-player SDK.
|
|
329
|
-
*/
|
|
330
|
-
playerRef.current = await createVeplayer({ viewId: '' });
|
|
331
|
-
playerRef.current.setListener({
|
|
332
|
-
onLoadStateChanged(engine, loadState) {
|
|
333
|
-
console.log('onLoadStateChanged: ', loadState);
|
|
334
|
-
},
|
|
335
|
-
onError(message, code) {
|
|
336
|
-
console.error('onError: ', message, code);
|
|
337
|
-
},
|
|
338
|
-
onPlaybackStateChanged(engine, playbackState) {
|
|
339
|
-
console.log('onPlaybackStateChanged: ', playbackState);
|
|
340
|
-
},
|
|
341
|
-
});
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
const initializeRTC = async () => {
|
|
345
|
-
/** Init your engine */
|
|
346
|
-
let DefaultPath = fs.ExternalDirectoryPath;
|
|
347
|
-
if (Platform.OS === 'ios') {
|
|
348
|
-
DefaultPath = fs.DocumentDirectoryPath;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/** Set log */
|
|
352
|
-
RTCClient.setLogConfig({
|
|
353
|
-
logLevel: LocalLogLevel.INFO,
|
|
354
|
-
logPath: DefaultPath,
|
|
355
|
-
logFileSize: 10,
|
|
356
|
-
logFilenamePrefix: '',
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
/** Create RTC Engine */
|
|
360
|
-
await RTCClient.createEngine({
|
|
361
|
-
appID: auth.appId,
|
|
362
|
-
parameters: {},
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
/** Set Local video canvas for player */
|
|
366
|
-
RTCClient.setLocalVideoCanvas(StreamIndex.STREAM_INDEX_SCREEN, {
|
|
367
|
-
viewId,
|
|
368
|
-
renderMode: RenderMode.ByteRTCRenderModeFit,
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
/** Join room */
|
|
372
|
-
RTCClient.createRoom(auth.roomId);
|
|
373
|
-
RTCClient.setRTCRoomEventHandler({
|
|
374
|
-
onUserJoined(userInfo, elapsed) {
|
|
375
|
-
console.log('onUserJoined: ', userInfo, elapsed);
|
|
376
|
-
},
|
|
377
|
-
});
|
|
378
|
-
RTCClient.joinRoom({
|
|
379
|
-
token: auth.token,
|
|
380
|
-
userId: auth.userId,
|
|
381
|
-
roomConfigs: {
|
|
382
|
-
profile: 0,
|
|
383
|
-
isAutoPublish: true,
|
|
384
|
-
isAutoSubscribeAudio: false,
|
|
385
|
-
isAutoSubscribeVideo: false,
|
|
386
|
-
},
|
|
387
|
-
});
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
useEffect(() => {
|
|
391
|
-
if (isViewLoaded) {
|
|
392
|
-
initializeRTC();
|
|
393
|
-
initializePlayer();
|
|
394
|
-
console.log('init success');
|
|
395
|
-
}
|
|
396
|
-
}, [isViewLoaded]);
|
|
397
|
-
|
|
398
|
-
useEffect(() => {
|
|
399
|
-
return () => {
|
|
400
|
-
RTCClient.engine?.stopVodPlayerCapture(playerRef.current);
|
|
401
|
-
}
|
|
402
|
-
}, []);
|
|
403
|
-
|
|
404
|
-
return (
|
|
405
|
-
<SafeAreaView>
|
|
406
|
-
<ScrollView
|
|
407
|
-
style={{
|
|
408
|
-
display: 'flex',
|
|
409
|
-
flexDirection: 'column',
|
|
410
|
-
width: '100%',
|
|
411
|
-
height: '100%',
|
|
412
|
-
backgroundColor: 'gray',
|
|
413
|
-
}}>
|
|
414
|
-
<RowItem
|
|
415
|
-
theme="dark"
|
|
416
|
-
leftItem="File path"
|
|
417
|
-
leftItemStyle={{width: '25%'}}
|
|
418
|
-
rightItem={
|
|
419
|
-
<Input disabled placeholder="Select media file" value={filepath} />
|
|
420
|
-
}
|
|
421
|
-
/>
|
|
422
|
-
<Button
|
|
423
|
-
style={{...GlobalStyles.rowBtn, marginBottom: 6}}
|
|
424
|
-
onPress={handleSelectVideoFile}>
|
|
425
|
-
<Text style={{color: 'gray'}}>Select media file</Text>
|
|
426
|
-
</Button>
|
|
427
|
-
<Button
|
|
428
|
-
style={{...GlobalStyles.rowBtn, marginBottom: 6}}
|
|
429
|
-
onPress={() => setFilepath('')}>
|
|
430
|
-
<Text style={{color: 'gray'}}>Clear media file</Text>
|
|
431
|
-
</Button>
|
|
432
|
-
<Button
|
|
433
|
-
style={{...GlobalStyles.rowBtn, marginBottom: 6}}
|
|
434
|
-
onPress={handlePublish}>
|
|
435
|
-
<Text style={{color: 'gray'}}>Push Stream</Text>
|
|
436
|
-
</Button>
|
|
437
|
-
<Button
|
|
438
|
-
style={{...GlobalStyles.rowBtn, marginBottom: 6}}
|
|
439
|
-
onPress={handlePlay}>
|
|
440
|
-
<Text style={{color: 'gray'}}>Play</Text>
|
|
441
|
-
</Button>
|
|
442
|
-
<Button
|
|
443
|
-
style={{...GlobalStyles.rowBtn, marginBottom: 6}}
|
|
444
|
-
onPress={handleStop}>
|
|
445
|
-
<Text style={{color: 'gray'}}>Pause</Text>
|
|
446
|
-
</Button>
|
|
447
|
-
<Button
|
|
448
|
-
style={{...GlobalStyles.rowBtn, marginBottom: 6}}
|
|
449
|
-
onPress={handleDestroy}>
|
|
450
|
-
<Text style={{color: 'gray'}}>Destroy</Text>
|
|
451
|
-
</Button>
|
|
452
|
-
<View
|
|
453
|
-
style={{
|
|
454
|
-
flex: 1,
|
|
455
|
-
width: '100%',
|
|
456
|
-
minHeight: 300,
|
|
457
|
-
backgroundColor: '#000',
|
|
458
|
-
}}>
|
|
459
|
-
<Text>{`${viewId}`}</Text>
|
|
460
|
-
<NativeViewComponent
|
|
461
|
-
viewId={viewId}
|
|
462
|
-
style={{
|
|
463
|
-
width: '100%',
|
|
464
|
-
height: '100%',
|
|
465
|
-
}}
|
|
466
|
-
onLoad={handleViewLoad}
|
|
467
|
-
kind={
|
|
468
|
-
Platform.select({
|
|
469
|
-
android: 'SurfaceView',
|
|
470
|
-
ios: 'UIView',
|
|
471
|
-
})!
|
|
472
|
-
}
|
|
473
|
-
/>
|
|
474
|
-
</View>
|
|
475
|
-
</ScrollView>
|
|
476
|
-
</SafeAreaView>
|
|
477
|
-
);
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
export default Page;
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
|
|
484
168
|
## Attention
|
|
485
169
|
- In Android/iOS scenarios, the screen sharing method is slightly different. For details, please refer to [Android screen sharing](https://docs.byteplus.com/en/docs/byteplus-rtc/docs-124176) and [iOS screen sharing](https://docs.byteplus.com/en/docs/byteplus-rtc/docs-124177).
|
|
486
170
|
- Not support debug in iOS simulator, using real device instead.
|
package/android/build.gradle
CHANGED
|
@@ -9,7 +9,34 @@ buildscript {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
def
|
|
12
|
+
def getLicenseType() {
|
|
13
|
+
try {
|
|
14
|
+
def packageJson = file("../../../../package.json")
|
|
15
|
+
def parsedJson = new groovy.json.JsonSlurper().parseText(packageJson.text)
|
|
16
|
+
return parsedJson.TTVideoEngine.licenseType
|
|
17
|
+
} catch (e) {
|
|
18
|
+
return "premium"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def enableUnionForRTCWithLive = project.findProperty('enableUnionForRTCWithLive') == null ? false : project.findProperty('enableUnionForRTCWithLive').toString().toBoolean()
|
|
23
|
+
def enableUnionForRTCWithVod = project.findProperty('enableUnionForRTCWithVod') == null ? false : project.findProperty('enableUnionForRTCWithVod').toString().toBoolean()
|
|
24
|
+
|
|
25
|
+
def packageJson = file("../package.json")
|
|
26
|
+
def parsedJson = new groovy.json.JsonSlurper().parseText(packageJson.text)
|
|
27
|
+
def isBp = parsedJson.name.startsWith("@byteplus")
|
|
28
|
+
|
|
29
|
+
def license_type = getLicenseType()
|
|
30
|
+
|
|
31
|
+
def rtcVersionToUse
|
|
32
|
+
if (isBp) {
|
|
33
|
+
rtcVersionToUse = enableUnionForRTCWithLive ? "3.58.1.20600" : "3.58.1.15100"
|
|
34
|
+
println "Using BytePlusRTC SDK version : $rtcVersionToUse (union live enabled: $enableUnionForRTCWithLive / union vod enabled: $enableUnionForRTCWithVod)"
|
|
35
|
+
} else {
|
|
36
|
+
rtcVersionToUse = enableUnionForRTCWithLive ? "3.58.1.20700" : "3.58.1.2700"
|
|
37
|
+
println "Using VolcEngineRTC SDK version : $rtcVersionToUse (union build enabled: $enableUnionForRTCWithLive / union vod enabled: $enableUnionForRTCWithVod)"
|
|
38
|
+
}
|
|
39
|
+
|
|
13
40
|
|
|
14
41
|
def isNewArchitectureEnabled() {
|
|
15
42
|
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
@@ -38,42 +65,16 @@ def supportsNamespace() {
|
|
|
38
65
|
return (major == 7 && minor >= 3) || major >= 8
|
|
39
66
|
}
|
|
40
67
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return "premium"
|
|
68
|
+
android {
|
|
69
|
+
sourceSets {
|
|
70
|
+
main {
|
|
71
|
+
java.srcDirs = ['src/main/java']
|
|
72
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
73
|
+
}
|
|
48
74
|
}
|
|
49
|
-
}
|
|
50
75
|
|
|
51
|
-
def getNativeDep() {
|
|
52
|
-
def packageJson = file("../package.json")
|
|
53
|
-
def parsedJson = new groovy.json.JsonSlurper().parseText(packageJson.text)
|
|
54
|
-
def isBp = parsedJson.name.startsWith("@byteplus")
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def rtcVersionToUse
|
|
58
|
-
if (isBp) {
|
|
59
|
-
rtcVersionToUse = enableUnionForRTCWithLive ? "3.58.1.20600" : "3.58.1.15100"
|
|
60
|
-
println "Using BytePlusRTC SDK version : $rtcVersionToUse (union build enabled: $enableUnionForRTCWithLive)"
|
|
61
|
-
return "com.byteplus:BytePlusRTC:$rtcVersionToUse"
|
|
62
|
-
}
|
|
63
|
-
rtcVersionToUse = enableUnionForRTCWithLive ? "3.58.1.20700" : "3.58.1.2700"
|
|
64
|
-
println "Using VolcEngineRTC SDK version : $rtcVersionToUse (union build enabled: $enableUnionForRTCWithLive)"
|
|
65
|
-
return "com.volcengine:VolcEngineRTC:$rtcVersionToUse"
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
android {
|
|
69
76
|
if (supportsNamespace()) {
|
|
70
77
|
namespace "com.volcengine.reactnative.vertc"
|
|
71
|
-
|
|
72
|
-
sourceSets {
|
|
73
|
-
main {
|
|
74
|
-
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
@@ -101,28 +102,35 @@ android {
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
def apiVolcEngineVersion = "1.6.2";
|
|
106
|
+
|
|
107
|
+
if (enableUnionForRTCWithLive) {
|
|
108
|
+
android.sourceSets.main.java.srcDirs += 'src/live/java'
|
|
109
|
+
dependencies {
|
|
110
|
+
implementation project(':byteplus_react-native-live-push')
|
|
111
|
+
implementation "com.bytedanceapi:ttsdk-player_$license_type:1.46.300.2"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (enableUnionForRTCWithVod) {
|
|
116
|
+
android.sourceSets.main.java.srcDirs += 'src/vod/java'
|
|
117
|
+
//
|
|
118
|
+
// Might cause rtc api some error, just alpha version.
|
|
119
|
+
//
|
|
120
|
+
apiVolcEngineVersion = '1.5.0'
|
|
121
|
+
dependencies {
|
|
122
|
+
implementation "com.bytedanceapi:ttsdk-player_$license_type:1.46.300.2"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
104
126
|
dependencies {
|
|
105
127
|
// For < 0.71, this will be from the local maven repo
|
|
106
128
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
107
129
|
// noinspection GradleDynamicVersion
|
|
108
130
|
implementation "com.facebook.react:react-native:+"
|
|
109
131
|
|
|
110
|
-
implementation "com.volcengine:VolcApiEngine
|
|
111
|
-
implementation project(':byteplus_react-native-live-push')
|
|
112
|
-
// implementation project(":hybrid-runtime");
|
|
132
|
+
implementation "com.volcengine:VolcApiEngine:$apiVolcEngineVersion"
|
|
113
133
|
|
|
114
134
|
// Use the RTC SDK dependency determined by getNativeDep() which can be overridden by customer's app build.gradle.
|
|
115
|
-
|
|
116
|
-
implementation rtcDep
|
|
117
|
-
|
|
118
|
-
// TTVideoEngine
|
|
119
|
-
// byteplus and volcengine use different name, different version
|
|
120
|
-
// volcengine com.bytedanceapi:ttsdk-player_premium:1.43.1.5 com.bytedanceapi:ttsdk-player_standard:1.43.1.5
|
|
121
|
-
// byteplus com.bytedanceapi:ttsdk-player_premium:1.42.300.101 com.bytedanceapi:ttsdk-player_standard:1.42.300.101
|
|
122
|
-
def license_type = getLicenseType()
|
|
123
|
-
implementation "com.bytedanceapi:ttsdk-player_$license_type:1.+"
|
|
124
|
-
|
|
125
|
-
if (enableUnionForRTCWithLive) {
|
|
126
|
-
api 'com.bytedanceapi:ttsdk-ttlivepush_rtc:1.46.300.2'
|
|
127
|
-
}
|
|
135
|
+
implementation isBp ? "com.byteplus:BytePlusRTC:$rtcVersionToUse" : "com.volcengine:VolcEngineRTC:$rtcVersionToUse"
|
|
128
136
|
}
|
|
@@ -136,6 +136,11 @@ public class VertcVod {
|
|
|
136
136
|
if (arg instanceof TTVideoEngine) {
|
|
137
137
|
return (TTVideoEngine)arg;
|
|
138
138
|
}
|
|
139
|
+
|
|
140
|
+
Object decoded = VolcApiEnginePool.getInstance().decodeArg(arg, null);
|
|
141
|
+
if (decoded instanceof TTVideoEngine) {
|
|
142
|
+
return (TTVideoEngine)arg;
|
|
143
|
+
}
|
|
139
144
|
|
|
140
145
|
return null;
|
|
141
146
|
}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
9
9
|
#import "RTCHeader.h"
|
|
10
|
-
#import <TTSDKFramework/TTSDKFramework.h>
|
|
11
10
|
#import <VertcHelper.h>
|
|
12
11
|
|
|
13
12
|
|
|
@@ -30,7 +29,11 @@
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
- (int)invokeStartPushSingleStreamToCDN:(ByteRTCVideo *)rtc taskId:(NSString *_Nonnull)taskID singleStream:(ByteRTCPushSingleStreamParam *_Nonnull)singleStream {
|
|
33
|
-
|
|
32
|
+
// Compatible live rtc version.
|
|
33
|
+
if ([singleStream respondsToSelector:NSSelectorFromString(@"setPushType:")]) {
|
|
34
|
+
// Can only use 1 magic number.
|
|
35
|
+
[singleStream setValue:@(1) forKey:@"pushType"];
|
|
36
|
+
}
|
|
34
37
|
singleStream.isScreen = singleStream.isScreen || false;
|
|
35
38
|
int res = [rtc startPushSingleStreamToCDN:taskID singleStream:singleStream observer:self];
|
|
36
39
|
return res;
|
package/package.json
CHANGED
package/react-native-rtc.podspec
CHANGED
|
@@ -30,10 +30,29 @@ Pod::Spec.new do |s|
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
s.pod_target_xcconfig = {
|
|
33
|
-
'ENABLE_UNION_FOR_RTC_WITH_LIVE' => '$(ENABLE_UNION_FOR_RTC_WITH_LIVE)'
|
|
33
|
+
'ENABLE_UNION_FOR_RTC_WITH_LIVE' => '$(ENABLE_UNION_FOR_RTC_WITH_LIVE)',
|
|
34
|
+
'ENABLE_UNION_FOR_RTC_WITH_VOD' => '$(ENABLE_UNION_FOR_RTC_WITH_VOD)'
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
s.
|
|
37
|
+
s.default_subspec = 'Core'
|
|
38
|
+
|
|
39
|
+
s.subspec 'Core' do |core|
|
|
40
|
+
core.source_files = 'ios/core/*.{h,m,mm,swift}'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
s.subspec 'Live' do |sub|
|
|
44
|
+
sub.source_files = [
|
|
45
|
+
'ios/core/*.{h,m,mm,swift}',
|
|
46
|
+
'ios/live/*.{h,m,mm,swift}'
|
|
47
|
+
]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
s.subspec 'Vod' do |sub|
|
|
51
|
+
sub.source_files = [
|
|
52
|
+
'ios/core/*.{h,m,mm,swift}',
|
|
53
|
+
'ios/vod/*.{h,m,mm,swift}'
|
|
54
|
+
]
|
|
55
|
+
end
|
|
37
56
|
|
|
38
57
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
39
58
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
@@ -60,35 +79,30 @@ Pod::Spec.new do |s|
|
|
|
60
79
|
|
|
61
80
|
s.dependency 'VolcApiEngine', '1.6.2'
|
|
62
81
|
|
|
63
|
-
|
|
82
|
+
enable_union_live = (ENV['ENABLE_UNION_FOR_RTC_WITH_LIVE'] == 'YES')
|
|
83
|
+
enable_union_vod = (ENV['ENABLE_UNION_FOR_RTC_WITH_VOD'] == 'YES')
|
|
64
84
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
puts "React-Native-RTC Pod: Using BytePlusRTC SDK version: #{rtc_version} (union build enabled: #{enable_union})"
|
|
85
|
+
rtc_sdk_name = is_bp ? 'BytePlusRTC' : 'VolcEngineRTC'
|
|
86
|
+
|
|
87
|
+
rtc_live_unique_version = is_bp ? '1.46.300.3-premium' : '1.46.3.9-premium'
|
|
88
|
+
rtc_default_version = is_bp ? '3.58.1.14800' : '3.58.1.100'
|
|
89
|
+
|
|
90
|
+
vod_player_sr_version = is_bp ? '1.45.300.3-premium' : '1.46.2.8-premium'
|
|
91
|
+
live_player_sr_version = is_bp ? '1.46.300.3-premium' : '1.46.3.9-premium'
|
|
92
|
+
|
|
93
|
+
if enable_union_live
|
|
94
|
+
# Live mode using unique RTC version.
|
|
95
|
+
s.dependency 'TTSDKFramework/RTCSDK', rtc_live_unique_version
|
|
96
|
+
# While using live mode, pusher RN sdk is require for getting pusher instance.
|
|
97
|
+
s.dependency 'react-native-velive-push'
|
|
98
|
+
s.dependency 'TTSDKFramework/Player-SR', live_player_sr_version
|
|
80
99
|
else
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
s.dependency 'VolcEngineRTC', rtc_version
|
|
89
|
-
s.dependency 'TTSDKFramework/Player-SR', '1.46.2.8-premium'
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
puts "React-Native-RTC Pod: Using VolcEngineRTC SDK version: #{rtc_version} (union build enabled: #{enable_union})"
|
|
100
|
+
# Vod mode or default mode using default rtc version.
|
|
101
|
+
s.dependency rtc_sdk_name, rtc_default_version
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if enable_union_vod
|
|
105
|
+
# 1.45.300.3 for vod.
|
|
106
|
+
s.dependency 'TTSDKFramework/Player-SR', vod_player_sr_version
|
|
93
107
|
end
|
|
94
108
|
end
|
/package/android/src/{main → live}/java/com/volcengine/reactnative/vertc/live/VertcLive.java
RENAMED
|
File without changes
|
/package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/OESTextureProcessor.java
RENAMED
|
File without changes
|
/package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/VideoAudioProcessor.java
RENAMED
|
File without changes
|
/package/android/src/{main → vod}/java/com/volcengine/reactnative/vertc/vod/VodAudioProcessor.java
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|