zby-live-sdk 1.0.49-beta-talrtc1104-2 → 1.0.49-beta-1222-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.49-beta-talrtc1104-2",
3
+ "version": "1.0.49-beta-1222-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.49-beta-talrtc1104-2';
16
+ export const version = '1.0.49-beta-1222-1';
17
17
 
18
18
  export const liveExt = {
19
19
  name: 'live',
package/src/notice.js CHANGED
@@ -180,6 +180,12 @@ export default {
180
180
  data
181
181
  });
182
182
  },
183
+ streamAbnormalLoss(data) {
184
+ notice({
185
+ type:'stream_abnormal_loss',
186
+ data
187
+ });
188
+ },
183
189
 
184
190
  // ----------播放器--------
185
191
  // 播放出错
@@ -1408,8 +1408,9 @@ export const pullAudioFlow = (playerId, operation, operator, streamid) => {
1408
1408
  defaultApi.writeLog(`pullAudioFlow -- playerId ${playerId} operation ${operation} streamId ${streamid}`);
1409
1409
  if(streamid){
1410
1410
  if(streamIdToRtcPlayerId[streamid] == undefined) {
1411
- NOTICE.pullAudioFlowError({streamid})
1412
- return
1411
+ NOTICE.pullAudioFlowError({ streamid });
1412
+ NOTICE.streamAbnormalLoss({ streamid, userid: util.getUidByStreamId(streamid), type: 'audio' });
1413
+ return;
1413
1414
  }else{
1414
1415
  playerId = streamIdToRtcPlayerId[streamid]
1415
1416
  console.log('pullAudioFlow-playerId',playerId,streamIdToPreviewId)
@@ -1453,6 +1454,11 @@ export const controlPullAudioOnly = (streamId, audioOnly) => {
1453
1454
  } catch (e) {
1454
1455
  console.log('controlPullAudioOnly_rtc ::streamIdRtcPlayerInfo1--error',e);
1455
1456
  }
1457
+ if (streamId) {
1458
+ if ( streamIdToRtcPlayerId[streamId] == undefined) {
1459
+ NOTICE.streamAbnormalLoss({ streamid: streamId, userid: util.getUidByStreamId(streamId), type: 'video' });
1460
+ }
1461
+ }
1456
1462
  const rtcPlayerId = streamIdToRtcPlayerId[streamId];
1457
1463
  return callMethod('ControlPullAudioOnly', {
1458
1464
  id: rtcPlayerId,
@@ -1809,11 +1809,13 @@ const pullAudioFlow = (playerId, mute, streamid) => {
1809
1809
 
1810
1810
  /**
1811
1811
  * @function 设置镜像状态(预览)
1812
- * @param { boolean } type true=开启 false=关闭
1813
- * @return: Promise
1812
+ * @param { number } mode 1=开启 0=关闭
1813
+ * @return {Promise}
1814
1814
  */
1815
- const setMirrorStatus = (isMirror) => {
1816
- return callMethod('SetMirrorStatus', { isMirror, streamId: localStreamId });
1815
+ const setMirrorStatus = (mode) => {
1816
+ const realId = mode == 0 ? 2 : 3;
1817
+ defaultApi.writeLog(`avsdk TALRTC::setMirrorStatus, mode: ${mode}, streamId:${localStreamId}, realId:${realId}`);
1818
+ return callMethod('SetMirrorStatus', { mode: realId, streamId: localStreamId });
1817
1819
  };
1818
1820
 
1819
1821
  /**
@@ -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 设备检测初始化
@@ -1592,8 +1597,7 @@ export const setPushViewMirror = (mode) => {
1592
1597
  case ZEGO:
1593
1598
  return zegosdk.setVideoMirrorMode(mode);
1594
1599
  case TALRTC:
1595
- // FIXME METHOD_NOT_IMPLEMENT;
1596
- break;
1600
+ return talrtcsdk.setMirrorStatus(mode);
1597
1601
  default:
1598
1602
  break;
1599
1603
  }
@@ -1808,6 +1812,11 @@ export const getStreamType_zego = () => {
1808
1812
  }
1809
1813
  };
1810
1814
 
1815
+ const setThirdAudioCallbackType = (sdkType) => {
1816
+ let type = sdkVale[sdkType];
1817
+ return zegosdk.setThirdAudioType(type);
1818
+ }
1819
+
1811
1820
 
1812
1821
  export default {
1813
1822
  init,
@@ -1886,6 +1895,7 @@ export default {
1886
1895
  sendMediaSideInfo,
1887
1896
  enableHighlight,
1888
1897
  setAUXAudioType,
1889
- mixedstuVideo
1898
+ mixedstuVideo,
1899
+ setThirdAudioCallbackType
1890
1900
  // getDeviceState
1891
1901
  };
@@ -2093,8 +2093,9 @@ export const pullAudioFlow = (playerId, operation, streamid) => {
2093
2093
  defaultApi.writeLog(`pullAudioFlow -- playerId ${playerId} operation ${operation} streamId ${streamid}`);
2094
2094
  if(streamid){
2095
2095
  if(streamIdToPreviewId[streamid] == undefined) {
2096
- NOTICE.pullAudioFlowError({streamid})
2097
- return
2096
+ NOTICE.pullAudioFlowError({ streamid });
2097
+ NOTICE.streamAbnormalLoss({ streamid, userid: util.getUidByStreamId(streamid), type: 'audio' });
2098
+ return;
2098
2099
  }else{
2099
2100
  playerId = streamIdToPreviewId[streamid]
2100
2101
  console.log('pullAudioFlow-playerId',playerId,streamIdToPreviewId)
@@ -2136,6 +2137,11 @@ export const activateVideoPlayStream = (streamId, bActive) => {
2136
2137
  } catch (e) {
2137
2138
  console.log('activateVideoPlayStream ::streamIdRtcPlayerInfo1 --error',e);
2138
2139
  }
2140
+ if (streamId) {
2141
+ if (streamIdToPreviewId[streamId] == undefined) {
2142
+ NOTICE.streamAbnormalLoss({ streamId, userid: util.getUidByStreamId(streamId), type: 'video' });
2143
+ }
2144
+ }
2139
2145
  return callMethod('ActivateVideoPlayStream', {
2140
2146
  nChannelIdx: streamIdToPreviewId[streamId],
2141
2147
  bActive
@@ -2410,7 +2416,7 @@ const setAudioAuxSource = (source) => {
2410
2416
  });
2411
2417
  }
2412
2418
 
2413
- //RTC同屏 辅助通道音频类型 0:静音 / 1:麦克风 / 2:拉流的声音 / 3:1+2 / 4:麦克风+扬声器
2419
+ //RTC同屏 辅助通道音频类型 0:静音 / 1:麦克风 / 2:拉流的声音 / 3:1+2 / 4:麦克风+扬声器 /5:扬声器(音乐)(没有拉流,没有外部混音没有调用,没有麦克风)
2414
2420
  const setAUXAudioType = (type) => {
2415
2421
  defaultApi.writeLog('info', 'avsdk ZEGO::SetAUXAudioType');
2416
2422
  return callMethod('SetAUXAudioType', {
@@ -2425,6 +2431,14 @@ const startAudioExCapture = (channel) => {
2425
2431
  channel
2426
2432
  });
2427
2433
  }
2434
+ /**
2435
+ * @function 设置第三路流音频类型
2436
+ * @param {number} type 音频类型 0:静音 / 1:麦克风 / 2:拉流的声音 / 3:1+2 / 4:麦克风+扬声器(音乐+拉流)(带外部混音) /8:麦克风+扬声器(音乐+拉流)(不带外部混音)/16:扬声器(音乐)(没有拉流,没有外部混音,没有麦克风)
2437
+ * @return: Promise
2438
+ */
2439
+ const setThirdAudioType = (type) => {
2440
+ return callMethod('SetThirdAudioType', { type })
2441
+ };
2428
2442
 
2429
2443
  //加载截屏插件
2430
2444
  const LoadCollectionOutputEntry2 = () => {
@@ -2983,5 +2997,6 @@ export default {
2983
2997
  addListener,
2984
2998
  stopCheckDevice,
2985
2999
  getDeviceCheckInitStatus,
2986
- setDeviceCheckInitStatus
3000
+ setDeviceCheckInitStatus,
3001
+ setThirdAudioType
2987
3002
  };
@@ -388,6 +388,7 @@ const zbysdk = {
388
388
  defaultApi.writeLog(`sdk status : setAudioCallbackType , sdk_type : ${sdk_type}`);
389
389
  try {
390
390
  await liveBaseApi.setAudioCallbackType(sdk_type);
391
+ await zbyAVSDK.setThirdAudioCallbackType(sdk_type);
391
392
  } catch (e) {
392
393
  defaultApi.writeLog(`sdk status : setAudioCallbackType , error : ${JSON.stringify(e)}`);
393
394
  };
@@ -580,7 +581,9 @@ const zbysdk = {
580
581
  }
581
582
 
582
583
  try {
584
+ console.log('开始设置rtmp声音回调',sdk_type);
583
585
  await liveBaseApi.setAudioCallbackType(sdk_type);
586
+ await zbyAVSDK.setThirdAudioCallbackType(sdk_type);
584
587
  } catch (error) {
585
588
  defaultApi.writeLog(`setAudioCallbackType error : ${JSON.stringify(error)}`);
586
589
  }