zby-live-sdk 1.0.48-beta0726-1 → 1.0.49-beta0825-1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zby-live-sdk",
3
- "version": "1.0.48-beta0726-1",
3
+ "version": "1.0.49-beta0825-1",
4
4
  "main": "dist/zby-live-sdk.cjs.js",
5
5
  "module": "dist/zby-live-sdk.esm.js",
6
6
  "browsers": "dist/zby-live-sdk.umd.js",
@@ -13,7 +13,7 @@ const urls = {
13
13
  };
14
14
 
15
15
  // export const version = require('../../package.json').version;
16
- export const version = '1.0.48-beta0726-1';
16
+ export const version = '1.0.49-beta0825-1';
17
17
 
18
18
  export const liveExt = {
19
19
  name: 'live',
package/src/live/base.js CHANGED
@@ -7,7 +7,12 @@
7
7
  */
8
8
  import callMethod from './call-method';
9
9
  import {liveExt} from '../config/config';
10
-
10
+ let sdkVale = {
11
+ zego: 0,
12
+ talrtc: 1,
13
+ trtc: 2,
14
+ rtc:3
15
+ }
11
16
  export default {
12
17
  async getLiveSdkVersion() {
13
18
  return callMethod('GetLiveSdkVersion', {});
@@ -18,6 +23,12 @@ export default {
18
23
  async isStreamVideoMuted() {
19
24
  return callMethod('IsStreamVideoMuted', {});
20
25
  },
26
+ //设置相应的sdk声音回调给到tm,解决回放关麦依旧有声音问题
27
+ async setAudioCallbackType(sdkType) {
28
+ let audio_source = sdkVale[sdkType]
29
+ console.log('setAudioCallbackType audio_source:', audio_source);
30
+ return callMethod('SetExternalAudioSource', {audio_source});
31
+ },
21
32
  // 初始化
22
33
  init(){
23
34
  // 加载扩展
@@ -89,6 +89,17 @@ const unloadUtils = () => {
89
89
  }
90
90
  };
91
91
 
92
+ export const isAppleM1 = () => {
93
+ defaultApi.writeLog(`获取设备是否是M1设备: isAppleM1 --start`);
94
+ return new Promise((resolve,reject) => {
95
+ EM.system.IsAppleSilicon((code, msg) => {
96
+ defaultApi.writeLog(`获取设备是否是M1设备: isAppleM1 code:${code} msg:${msg}`);
97
+ let data = JSON.parse(msg);
98
+ resolve({ code, data });
99
+ });
100
+ })
101
+ };
102
+
92
103
  /**
93
104
  * @function 获取设备状态
94
105
  * * @param { string } devicename //(设备名称,可为空)
@@ -387,6 +387,11 @@ const init = async (args) => {
387
387
  //坐立模式开启外部采集器,站立关闭外部采集器,只有小组课坐立模式才会调用,通过这个把rtmp数据给到zego或者rtc(头像),开启了外部采集,zego不会再本地采集数据
388
388
  await setEnableExternVideoCapture(true);
389
389
  }
390
+ //小班课 需要加载采集插件的输入数据,为了拼接zego头像
391
+ if (args.classMode === 1 || args.classMode === 2) {
392
+ defaultApi.writeLog('loadCollectionInputEntry')
393
+ loadCollectionInputEntry();
394
+ };
390
395
  await setCameraEncodeBiarate(args.encodeCaptureBitrate);
391
396
  await setCameraEncodeFps(args.encodeCaptureFps);
392
397
  await setCameraCaptureResolution(args.previewResolutionWidth, args.previewResolutionHeight);
@@ -1405,6 +1410,10 @@ const pullAudioFlow = async (playerId, operation, streamid) => {
1405
1410
  const setFocusStreams = (bFocus, streamIdarr) => {
1406
1411
  return callMethod('SetFocusStreams', {bFocus, streamId1, streamId1, streamId1, streamId1});
1407
1412
  }
1413
+ //加载采集插件的输入数据
1414
+ export const loadCollectionInputEntry = () => {
1415
+ return callMethod('LoadCollectionInputEntry', {});
1416
+ };
1408
1417
 
1409
1418
  //加载截屏插件
1410
1419
  const LoadCollectionOutputEntry2 = () => {
@@ -20,6 +20,11 @@ const rtcReportUrl = {
20
20
  test: 'test-r.weclassroom.com',
21
21
  online: 'r.weclassroom.com'
22
22
  };
23
+ const sdkVale = {
24
+ zego: 8, //8代表zego采集麦克风+扬声器
25
+ talrtc: 101, //101代表talrtc采集声音
26
+ trtc: 102, //102代表trtc采集声音
27
+ }
23
28
 
24
29
  /**
25
30
  * @function 设备检测初始化
@@ -516,7 +521,11 @@ export const stopPushFlow = (idx, streamId) => {
516
521
  */
517
522
  export const initPullFlow = (args) => {
518
523
  switch (window.zbyAVSDK_init_sdk_type) {
519
- case RTC:
524
+ case RTC:
525
+ //判断是否是M1设备
526
+ if (window.zby_isM1Type) {
527
+ return;
528
+ }
520
529
  return {
521
530
  sdk_type: RTC,
522
531
  videoSrc: rtcsdk.initPullFlow(args.streamId, args.domId, args.mute, args.renderId, args.notAutoPlay, args.audioOnly, args.needScale, args.scaleParams, args.streamType)
@@ -1803,6 +1812,11 @@ export const getStreamType_zego = () => {
1803
1812
  }
1804
1813
  };
1805
1814
 
1815
+ const setThirdAudioCallbackType = (sdkType) => {
1816
+ let type = sdkVale[sdkType];
1817
+ return zegosdk.setThirdAudioType(type);
1818
+ }
1819
+
1806
1820
 
1807
1821
  export default {
1808
1822
  init,
@@ -1881,6 +1895,7 @@ export default {
1881
1895
  sendMediaSideInfo,
1882
1896
  enableHighlight,
1883
1897
  setAUXAudioType,
1884
- mixedstuVideo
1898
+ mixedstuVideo,
1899
+ setThirdAudioCallbackType
1885
1900
  // getDeviceState
1886
1901
  };
@@ -2410,7 +2410,7 @@ const setAudioAuxSource = (source) => {
2410
2410
  });
2411
2411
  }
2412
2412
 
2413
- //RTC同屏 辅助通道音频类型 0:静音 / 1:麦克风 / 2:拉流的声音 / 3:1+2 / 4:麦克风+扬声器
2413
+ //RTC同屏 辅助通道音频类型 0:静音 / 1:麦克风 / 2:拉流的声音 / 3:1+2 / 4:麦克风+扬声器 /5:扬声器(音乐)(没有拉流,没有外部混音没有调用,没有麦克风)
2414
2414
  const setAUXAudioType = (type) => {
2415
2415
  defaultApi.writeLog('info', 'avsdk ZEGO::SetAUXAudioType');
2416
2416
  return callMethod('SetAUXAudioType', {
@@ -2425,6 +2425,14 @@ const startAudioExCapture = (channel) => {
2425
2425
  channel
2426
2426
  });
2427
2427
  }
2428
+ /**
2429
+ * @function 设置第三路流音频类型
2430
+ * @param {number} type 音频类型 0:静音 / 1:麦克风 / 2:拉流的声音 / 3:1+2 / 4:麦克风+扬声器(音乐+拉流)(带外部混音) /8:麦克风+扬声器(音乐+拉流)(不带外部混音)/16:扬声器(音乐)(没有拉流,没有外部混音,没有麦克风)
2431
+ * @return: Promise
2432
+ */
2433
+ const setThirdAudioType = (type) => {
2434
+ return callMethod('SetThirdAudioType', { type })
2435
+ };
2428
2436
 
2429
2437
  //加载截屏插件
2430
2438
  const LoadCollectionOutputEntry2 = () => {
@@ -2983,5 +2991,6 @@ export default {
2983
2991
  addListener,
2984
2992
  stopCheckDevice,
2985
2993
  getDeviceCheckInitStatus,
2986
- setDeviceCheckInitStatus
2994
+ setDeviceCheckInitStatus,
2995
+ setThirdAudioType
2987
2996
  };
@@ -21,7 +21,7 @@ import {
21
21
  import toolBaseApi from './tool/base';
22
22
  import liveBaseApi from './live/base';
23
23
  import defaultApi from './default';
24
- import {getDevicePermissionsFun, setMediaPermissionFun} from './zby-av-sdk/device';
24
+ import {getDevicePermissionsFun, setMediaPermissionFun, isAppleM1} from './zby-av-sdk/device';
25
25
  import NOTICE from './notice';
26
26
 
27
27
  // window.zegoHasPushFlow = 0
@@ -380,6 +380,13 @@ const zbysdk = {
380
380
  defaultApi.writeLog(`sdk init AVSDK init_failed ${JSON.stringify(error)}`);
381
381
  return;
382
382
  });
383
+ defaultApi.writeLog(`sdk status : setAudioCallbackType , sdk_type : ${sdk_type}`);
384
+ try {
385
+ await liveBaseApi.setAudioCallbackType(sdk_type);
386
+ await zbyAVSDK.setThirdAudioCallbackType(sdk_type);
387
+ } catch (e) {
388
+ defaultApi.writeLog(`sdk status : setAudioCallbackType , error : ${JSON.stringify(e)}`);
389
+ };
383
390
  try {
384
391
  // dataReport.joinRoom({initParams: JSON.stringify(args)});
385
392
  dataReport.joinRoom({initParams: args});
@@ -390,6 +397,11 @@ const zbysdk = {
390
397
  sdk_type,
391
398
  status: 'init_finished'
392
399
  });
400
+ try {
401
+ window.zby_isM1Type =(await isAppleM1()).data.is_Apple_Silicon;
402
+ } catch (error) {
403
+ defaultApi.writeLog(`sdk action : isAppleM1 error ${JSON.stringify(error)}`);
404
+ }
393
405
  try{
394
406
  dataReport.initFinished({code:0});
395
407
  }catch (e){ }
@@ -563,6 +575,14 @@ const zbysdk = {
563
575
  window.target_sdk_type = null;
564
576
  }
565
577
 
578
+ try {
579
+ console.log('开始设置rtmp声音回调',sdk_type);
580
+ await liveBaseApi.setAudioCallbackType(sdk_type);
581
+ await zbyAVSDK.setThirdAudioCallbackType(sdk_type);
582
+ } catch (error) {
583
+ defaultApi.writeLog(`setAudioCallbackType error : ${JSON.stringify(error)}`);
584
+ }
585
+
566
586
  try {
567
587
  dataReport.sdkChange({
568
588
  from: nowSdk,