zby-live-sdk 1.0.49-beta-talrtc0831 → 1.0.49-beta-talrtc0920

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-talrtc0831",
3
+ "version": "1.0.49-beta-talrtc0920",
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-talrtc0831';
16
+ export const version = '1.0.49-beta-talrtc0920';
17
17
 
18
18
  export const liveExt = {
19
19
  name: 'live',
@@ -52,6 +52,7 @@ let localRoomId = null;
52
52
  let userId = null;
53
53
  let isNoticeMicVolume = false;
54
54
  let enableLocalCapture = true; // 本地摄像头采集,默认允许
55
+ let teacherId = null;
55
56
  // /**
56
57
  // * 过滤直播云sdk中deviceId前缀
57
58
  // * @param {string} deviceId
@@ -425,12 +426,13 @@ const init = async (args) => {
425
426
  localRoomId = args.roomId;
426
427
  userId = args.userId;
427
428
  localStreamId = args.streamId;
429
+ teacherId = args.teacherId;
428
430
  const _devices = {
429
431
  camera: (devices && devices.camera) || (usedDevices && usedDevices.camera && usedDevices.camera.use) || '',
430
432
  microphone: (devices && devices.microphone) || (usedDevices && usedDevices.microphone && usedDevices.microphone.use) || '',
431
433
  speaker: (devices && devices.speaker) || (usedDevices && usedDevices.speaker && usedDevices.speaker.use) || ''
432
434
  };
433
- console.log('-> load talrtc sdk');
435
+ console.log('-> load talrtc sdk. teacherId: ', teacherId);
434
436
  await loadTalrtc(args.extensionVersion);
435
437
  console.log('-> load talrtc sdk finished ');
436
438
  const resp = await startEngine(args.appId, args.userId, args.usersign || '67890', 7, args.live_id);
@@ -454,6 +456,7 @@ const init = async (args) => {
454
456
 
455
457
  //rtc同屏以及高光时刻,都开启音频外部采集,默认传1
456
458
  await setAudioAuxSource(1);
459
+ teacherId = null;
457
460
  }
458
461
 
459
462
  if(args.noiseSuppressMode == -2) {
@@ -1498,6 +1501,8 @@ const startPush = async (streamId) => {
1498
1501
  if (streamId === screenStreamId) {
1499
1502
  isScreenSharing = true;
1500
1503
  }
1504
+ setAudioType(4, localStreamId); // 设置采集类型,不用await,避免接口挂起导致未推流
1505
+
1501
1506
  defaultApi.writeLog(`avsdk TALSDK::startPush streamId: ${streamId}`);
1502
1507
  try {
1503
1508
  if (!isFirstHeartBeatReport) {
@@ -1592,6 +1597,7 @@ const startPlay = (streamId, muteAudio, muteVideo) => {
1592
1597
  }
1593
1598
  defaultApi.writeLog(`avsdk TALSDK::startPlay streamId: ${streamId}, muteAudio: ${muteAudio}, muteVideo: ${muteVideo}`);
1594
1599
  return callMethod('StartPlay', {
1600
+ myStreamId: localStreamId,
1595
1601
  streamId,
1596
1602
  muteAudio,
1597
1603
  muteVideo,
@@ -1864,10 +1870,19 @@ const setAudioAuxSource = (source) => {
1864
1870
  });
1865
1871
  };
1866
1872
 
1867
- //RTC同屏 辅助通道音频类型 0:静音 / 1:麦克风 / 2:拉流的声音 / 3:1+2 / 4:麦克风+扬声器
1868
- const setAUXAudioType = (type) => {
1869
- defaultApi.writeLog('info', 'avsdk TALRTC::SetAUXAudioType');
1870
- return callMethod('SetAUXAudioType', {
1873
+ /**
1874
+ * RTC流音频类型
1875
+ * @param {number} type 音频类型 0:静音 / 1:麦克风 / 2:拉流的声音 / 3:1+2 / 4:麦克风+扬声器 5: 扬声器
1876
+ * @param {string} streamId 流
1877
+ * @returns {Promise<void>}
1878
+ */
1879
+ const setAudioType = (type, streamId) => {
1880
+ defaultApi.writeLog('info', 'avsdk TALRTC::SetAudioType');
1881
+ if (!streamId) {
1882
+ streamId = screenStreamId;
1883
+ }
1884
+ return callMethod('SetAudioType', {
1885
+ streamId,
1871
1886
  type
1872
1887
  });
1873
1888
  };
@@ -1920,6 +1935,10 @@ export const setAudioMixMode = async (mixMode, streamIdArr) => {
1920
1935
  // });
1921
1936
  // }
1922
1937
  if (!Array.isArray(streamIdArr)) return;
1938
+
1939
+ if (teacherId && !streamIdArr.includes(teacherId)) {
1940
+ streamIdArr.push(teacherId);
1941
+ }
1923
1942
  return callMethod('SetAudioMixMode', {mixMode: mixMode, streamIdArr, num: streamIdArr.length});
1924
1943
  };
1925
1944
 
@@ -1955,6 +1974,10 @@ const leaveRoom = async () => {
1955
1974
  previewIdToStreamId = {};
1956
1975
  streamIdRtcPlayerInfo = {};
1957
1976
  streamIdRtcPlayerInfo1 = {};
1977
+ uiChnIndexs.length = 100;
1978
+ uiChnIndexs.fill(0).forEach((value, index, array) => {
1979
+ array[index] = array.length - (index + 1);
1980
+ });
1958
1981
  };
1959
1982
 
1960
1983
 
@@ -2320,7 +2343,7 @@ export default {
2320
2343
  setMirrorStatus,
2321
2344
  setPlayViewMirror,
2322
2345
  setAudioAuxSource,
2323
- setAUXAudioType,
2346
+ setAudioType,
2324
2347
  startAudioExCapture,
2325
2348
  startMultiScreen,
2326
2349
  setAudioMixMode,
@@ -1243,7 +1243,7 @@ export const getSnapshootId = (streamId) => {
1243
1243
  }
1244
1244
  break;
1245
1245
  case TALRTC:
1246
- if (zegosdk.hasStream(streamId)) {
1246
+ if (talrtcsdk.hasStream(streamId)) {
1247
1247
  return talrtcsdk.getChannelIndex(streamId);
1248
1248
  } else {
1249
1249
  defaultApi.writeLog(`talrtcsdk getSnapshootId , no streamId: ${streamId} in talrtc room`);
@@ -1786,6 +1786,8 @@ export const setAUXAudioType = (type) => {
1786
1786
  break;
1787
1787
  case ZEGO:
1788
1788
  return zegosdk.setAUXAudioType(type);
1789
+ case TALRTC:
1790
+ return talrtcsdk.setAudioType(type);
1789
1791
  default:
1790
1792
  break;
1791
1793
  }
@@ -198,6 +198,7 @@ function caculateDeatailArgs(baseArgs, cloudData) {
198
198
  extensionVersion: baseArgs.extension.version.agora || '1.0.0.0',
199
199
  appId: cloudData.appId,
200
200
  usersign: 'testsign',
201
+ teacherId: baseArgs.teacherId
201
202
  }),
202
203
  trtc: Object.assign({}, commonArgs, liveConfig, {
203
204
  extensionVersion: baseArgs.extension.version.trtc || '1.0.0.0',