@tencentcloud/trtc-cloud-wx 0.0.9 → 0.0.10

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/trtc-cloud-wx.js +87 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencentcloud/trtc-cloud-wx",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "",
5
5
  "main": "./trtc-cloud-wx.js",
6
6
  "type": "module",
package/trtc-cloud-wx.js CHANGED
@@ -700,9 +700,10 @@ var aegis = new Aegis({
700
700
  var LOGLEVEL = {
701
701
  LOG: 0,
702
702
  INFO: 1,
703
- WARN: 2,
704
- ERROR: 3,
705
- NON_LOGGING: 4 // 无日志记录级别,sdk将不打印任何日志
703
+ DEBUG: 2,
704
+ WARN: 3,
705
+ ERROR: 4,
706
+ NON_LOGGING: 5 // 无日志记录级别,sdk将不打印任何日志
706
707
  };
707
708
 
708
709
  var Logger = /*#__PURE__*/function () {
@@ -715,6 +716,7 @@ var Logger = /*#__PURE__*/function () {
715
716
  _createClass(Logger, [{
716
717
  key: "loggerInfo",
717
718
  value: function loggerInfo() {
719
+ if (Number(this.sdkAppId) !== 1400188366 && Number(this.sdkAppId) !== 1400704311) return;
718
720
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
719
721
  args[_key] = arguments[_key];
720
722
  }
@@ -793,6 +795,19 @@ var Logger = /*#__PURE__*/function () {
793
795
  this.loggerInfo.apply(this, [this.TAG_NAME, formatTime()].concat(args));
794
796
  }
795
797
  }
798
+ }, {
799
+ key: "debug",
800
+ value: function debug() {
801
+ // 状态机内部错误信息
802
+ if (this.logLevel <= LOGLEVEL.DEBUG) {
803
+ var _console5;
804
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
805
+ args[_key6] = arguments[_key6];
806
+ }
807
+ (_console5 = console).debug.apply(_console5, [this.TAG_NAME, formatTime()].concat(args));
808
+ this.loggerInfo.apply(this, [this.TAG_NAME, formatTime()].concat(args));
809
+ }
810
+ }
796
811
  }]);
797
812
  return Logger;
798
813
  }();
@@ -1155,12 +1170,14 @@ var TRTCCloud = /*#__PURE__*/function () {
1155
1170
  callback: function callback() {
1156
1171
  _this5.trtc.getPusherInstance().start({
1157
1172
  success: function success() {
1173
+ logger.info('enterRoom success');
1158
1174
  _this5.scene = scene;
1159
1175
  _this5.isEnterRoom = true;
1160
1176
  var endTime = new Date().getTime();
1161
1177
  _this5.emit('onEnterRoom', endTime - startTime);
1162
1178
  },
1163
1179
  fail: function fail() {
1180
+ logger.info('enterRoom fail');
1164
1181
  _this5.emit('onEnterRoom', -1);
1165
1182
  }
1166
1183
  });
@@ -1180,6 +1197,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1180
1197
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1181
1198
  pusher: pusher,
1182
1199
  callback: function callback() {
1200
+ logger.info('exitRoom success');
1183
1201
  _this6.reset();
1184
1202
  _this6.emit('onExitRoom', 0);
1185
1203
  }
@@ -1213,6 +1231,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1213
1231
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1214
1232
  pusher: pusher,
1215
1233
  callback: function callback() {
1234
+ logger.info('switchRole success');
1216
1235
  _this7.emit('onSwitchRole', 0, '');
1217
1236
  }
1218
1237
  });
@@ -1253,13 +1272,14 @@ var TRTCCloud = /*#__PURE__*/function () {
1253
1272
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1254
1273
  while (1) switch (_context.prev = _context.next) {
1255
1274
  case 0:
1275
+ logger.info('startLocalPreview success');
1256
1276
  this.emit('onFirstVideoFrame', '', exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig, pusher.videoWidth, pusher.videoHeight);
1257
1277
  if (this.isEnterRoom) {
1258
1278
  this.emit('onSendFirstLocalVideoFrame', exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1259
1279
  }
1260
1280
  resolve(null);
1261
1281
  this.isOpenCamera = true;
1262
- case 4:
1282
+ case 5:
1263
1283
  case "end":
1264
1284
  return _context.stop();
1265
1285
  }
@@ -1285,6 +1305,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1285
1305
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1286
1306
  pusher: pusher,
1287
1307
  callback: function callback() {
1308
+ logger.info('stopLocalPreview success');
1288
1309
  _this9.isOpenCamera = false;
1289
1310
  _this9.emit('onUserVideoAvailable', _this9.userId, 0);
1290
1311
  }
@@ -1332,6 +1353,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1332
1353
  _this10.InterfaceEventEmitter.emit('pusherAttributesChange', {
1333
1354
  pusher: pusher,
1334
1355
  callback: function callback() {
1356
+ logger.info('muteLocalVideo success');
1335
1357
  resolve(null);
1336
1358
  }
1337
1359
  });
@@ -1364,6 +1386,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1364
1386
  view: this.renderMap.get(streamId),
1365
1387
  playerAttributes: playerAttributes,
1366
1388
  callback: function callback() {
1389
+ logger.info('startRemoteView success');
1367
1390
  _this11.emit('onFirstVideoFrame', userId, streamType, 0, 0);
1368
1391
  }
1369
1392
  });
@@ -1385,7 +1408,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1385
1408
  this.InterfaceEventEmitter.emit('playerAttributesChange', {
1386
1409
  streamId: streamId,
1387
1410
  view: this.renderMap.get(streamId),
1388
- playerAttributes: playerAttributes
1411
+ playerAttributes: playerAttributes,
1412
+ callback: function callback() {
1413
+ logger.info('stopRemoteView success');
1414
+ }
1389
1415
  });
1390
1416
  }
1391
1417
  /**
@@ -1423,7 +1449,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1423
1449
  _this12.InterfaceEventEmitter.emit('playerAttributesChange', {
1424
1450
  streamId: streamId,
1425
1451
  view: _this12.renderMap.get(streamId),
1426
- playerAttributes: playerAttributes
1452
+ playerAttributes: playerAttributes,
1453
+ callback: function callback() {
1454
+ logger.info('stopAllRemoteView success');
1455
+ }
1427
1456
  });
1428
1457
  });
1429
1458
  }
@@ -1440,7 +1469,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1440
1469
  this.InterfaceEventEmitter.emit('playerAttributesChange', {
1441
1470
  streamId: streamId,
1442
1471
  view: this.renderMap.get(streamId),
1443
- playerAttributes: playerAttributes
1472
+ playerAttributes: playerAttributes,
1473
+ callback: function callback() {
1474
+ logger.info('muteRemoteVideoStream success');
1475
+ }
1444
1476
  });
1445
1477
  }
1446
1478
  }, {
@@ -1457,7 +1489,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1457
1489
  _this13.InterfaceEventEmitter.emit('playerAttributesChange', {
1458
1490
  streamId: streamId,
1459
1491
  view: _this13.renderMap.get(streamId),
1460
- playerAttributes: playerAttributes
1492
+ playerAttributes: playerAttributes,
1493
+ callback: function callback() {
1494
+ logger.info('muteAllRemoteVideoStreams success');
1495
+ }
1461
1496
  });
1462
1497
  });
1463
1498
  }
@@ -1491,7 +1526,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1491
1526
  minBitrate: minVideoBitrate
1492
1527
  });
1493
1528
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1494
- pusher: pusher
1529
+ pusher: pusher,
1530
+ callback: function callback() {
1531
+ logger.info('setVideoEncoderParam success');
1532
+ }
1495
1533
  });
1496
1534
  }
1497
1535
  }, {
@@ -1508,7 +1546,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1508
1546
  localMirror: localMirror
1509
1547
  });
1510
1548
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1511
- pusher: pusher
1549
+ pusher: pusher,
1550
+ callback: function callback() {
1551
+ logger.info('setLocalRenderParams success');
1552
+ }
1512
1553
  });
1513
1554
  }
1514
1555
  /**
@@ -1532,7 +1573,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1532
1573
  this.InterfaceEventEmitter.emit('playerAttributesChange', {
1533
1574
  streamId: streamId,
1534
1575
  view: this.renderMap.get(streamId),
1535
- playerAttributes: playerAttributes
1576
+ playerAttributes: playerAttributes,
1577
+ callback: function callback() {
1578
+ logger.info('setRemoteRenderParams success');
1579
+ }
1536
1580
  });
1537
1581
  }
1538
1582
  }, {
@@ -1546,6 +1590,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1546
1590
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1547
1591
  pusher: pusher,
1548
1592
  callback: function callback() {
1593
+ logger.info('startLocalAudio success');
1549
1594
  _this14.emit('onMicDidReady');
1550
1595
  _this14.emit('onUserAudioAvailable', _this14.userId, 1);
1551
1596
  if (_this14.enterRoom) {
@@ -1565,6 +1610,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1565
1610
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1566
1611
  pusher: pusher,
1567
1612
  callback: function callback() {
1613
+ logger.info('stopLocalAudio success');
1568
1614
  _this15.emit('onUserAudioAvailable', _this15.userId, 0);
1569
1615
  }
1570
1616
  });
@@ -1580,6 +1626,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1580
1626
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1581
1627
  pusher: pusher,
1582
1628
  callback: function callback() {
1629
+ logger.info('muteLocalAudio success');
1583
1630
  _this16.emit('onUserAudioAvailable', _this16.userId, mute === true ? 0 : 1);
1584
1631
  }
1585
1632
  });
@@ -1595,7 +1642,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1595
1642
  this.InterfaceEventEmitter.emit('playerAttributesChange', {
1596
1643
  streamId: streamId,
1597
1644
  view: this.renderMap.get(streamId),
1598
- playerAttributes: playerAttributes
1645
+ playerAttributes: playerAttributes,
1646
+ callback: function callback() {
1647
+ logger.info('muteRemoteAudio success');
1648
+ }
1599
1649
  });
1600
1650
  }
1601
1651
  }, {
@@ -1612,7 +1662,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1612
1662
  _this17.InterfaceEventEmitter.emit('playerAttributesChange', {
1613
1663
  streamId: streamId,
1614
1664
  view: _this17.renderMap.get(streamId),
1615
- playerAttributes: playerAttributes
1665
+ playerAttributes: playerAttributes,
1666
+ callback: function callback() {
1667
+ logger.info('muteAllRemoteAudio success');
1668
+ }
1616
1669
  });
1617
1670
  });
1618
1671
  }
@@ -1639,11 +1692,15 @@ var TRTCCloud = /*#__PURE__*/function () {
1639
1692
  frontCamera: true
1640
1693
  });
1641
1694
  _this18.InterfaceEventEmitter.emit('pusherAttributesChange', {
1642
- pusher: pusher
1695
+ pusher: pusher,
1696
+ callback: function callback() {
1697
+ logger.info('switchCamera success');
1698
+ }
1643
1699
  });
1644
1700
  resolve(event);
1645
1701
  },
1646
1702
  fail: function fail(error) {
1703
+ logger.info('switchCamera fail');
1647
1704
  reject(error);
1648
1705
  }
1649
1706
  });
@@ -1659,7 +1716,10 @@ var TRTCCloud = /*#__PURE__*/function () {
1659
1716
  whitenessLevel: white
1660
1717
  });
1661
1718
  this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1662
- pusher: pusher
1719
+ pusher: pusher,
1720
+ callback: function callback() {
1721
+ logger.info('setBeautyStyle success');
1722
+ }
1663
1723
  });
1664
1724
  }
1665
1725
  }, {
@@ -1671,9 +1731,11 @@ var TRTCCloud = /*#__PURE__*/function () {
1671
1731
  wx.createLivePusherContext().sendMessage({
1672
1732
  msg: msg,
1673
1733
  success: function success(event) {
1734
+ logger.info('sendSEIMsg success');
1674
1735
  resolve(event);
1675
1736
  },
1676
1737
  fail: function fail(error) {
1738
+ logger.info('sendSEIMsg fail');
1677
1739
  reject(error);
1678
1740
  }
1679
1741
  });
@@ -1694,9 +1756,11 @@ var TRTCCloud = /*#__PURE__*/function () {
1694
1756
  startTimeMs: startTimeMS,
1695
1757
  endTimeMs: endTimeMS,
1696
1758
  success: function success(event) {
1759
+ logger.info('startPlayMusic success');
1697
1760
  resolve(event);
1698
1761
  },
1699
1762
  fail: function fail(error) {
1763
+ logger.info('startPlayMusic fail');
1700
1764
  reject(error);
1701
1765
  }
1702
1766
  });
@@ -1709,9 +1773,11 @@ var TRTCCloud = /*#__PURE__*/function () {
1709
1773
  return new Promise(function (resolve, reject) {
1710
1774
  wx.createLivePusherContext().stopBGM({
1711
1775
  success: function success(event) {
1776
+ logger.info('stopPlayMusic success');
1712
1777
  resolve(event);
1713
1778
  },
1714
1779
  fail: function fail(error) {
1780
+ logger.info('stopPlayMusic fail');
1715
1781
  reject(error);
1716
1782
  }
1717
1783
  });
@@ -1724,9 +1790,11 @@ var TRTCCloud = /*#__PURE__*/function () {
1724
1790
  return new Promise(function (resolve, reject) {
1725
1791
  wx.createLivePusherContext().pauseBGM({
1726
1792
  success: function success(event) {
1793
+ logger.info('pausePlayMusic success');
1727
1794
  resolve(event);
1728
1795
  },
1729
1796
  fail: function fail(error) {
1797
+ logger.info('pausePlayMusic fail');
1730
1798
  reject(error);
1731
1799
  }
1732
1800
  });
@@ -1739,9 +1807,11 @@ var TRTCCloud = /*#__PURE__*/function () {
1739
1807
  return new Promise(function (resolve, reject) {
1740
1808
  wx.createLivePusherContext().resumeBGM({
1741
1809
  success: function success(event) {
1810
+ logger.info('resumePlayMusic success');
1742
1811
  resolve(event);
1743
1812
  },
1744
1813
  fail: function fail(error) {
1814
+ logger.info('resumePlayMusic fail');
1745
1815
  reject(error);
1746
1816
  }
1747
1817
  });
@@ -1757,9 +1827,11 @@ var TRTCCloud = /*#__PURE__*/function () {
1757
1827
  wx.createLivePusherContext().setBGMVolume({
1758
1828
  volume: volumeStr,
1759
1829
  success: function success(event) {
1830
+ logger.info('setAllMusicVolume success');
1760
1831
  resolve(event);
1761
1832
  },
1762
1833
  fail: function fail(error) {
1834
+ logger.info('setAllMusicVolume fail');
1763
1835
  reject(error);
1764
1836
  }
1765
1837
  });