trtc-sdk-v5 5.6.0-beta.2 → 5.6.0-beta.4

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/index.d.ts CHANGED
@@ -785,20 +785,6 @@
785
785
  * })
786
786
  */
787
787
  readonly TRACK: "track";
788
- /**
789
- * @since v5.6.0
790
- * @description received a new custom message.
791
- * @default 'custom-message'
792
- * @memberof module:EVENT
793
- * @example
794
- * trtc.on(TRTC.EVENT.CUSTOM_MESSAGE, event => {
795
- * // event.userId: remote userId.
796
- * // event.cmdId: message cmdId.
797
- * // event.seq: message sequence number.
798
- * // event.message: custom message data, type is ArrayBuffer.
799
- * })
800
- */
801
- readonly CUSTOM_MESSAGE: "custom-message";
802
788
  };
803
789
  declare interface TRTCEventTypes {
804
790
  [TRTCEvent.ERROR]: [RtcError];
@@ -876,7 +862,6 @@
876
862
  streamType?: TRTCStreamType;
877
863
  track: MediaStreamTrack;
878
864
  }];
879
- [TRTCEvent.CUSTOM_MESSAGE]: [CustomMessage];
880
865
  }
881
866
  class TRTC extends EventEmitter<TRTCEventTypes> {
882
867
  /**
@@ -1516,28 +1501,6 @@
1516
1501
  * trtc.off('*');
1517
1502
  */
1518
1503
  off<T extends keyof TRTCEventTypes>(event: T | '*', handler: T extends '*' ? never : (...args: TRTCEventTypes[T]) => void, context?: any): this;
1519
- /**
1520
- * Get audio track
1521
- *
1522
- * @returns {MediaStreamTrack?} Audio track
1523
- * @param {Object|string} [config] If not passed, get the local microphone audioTrack
1524
- * @param {string} [config.userId] If not passed or passed an empty string, get the local audioTrack. Pass the userId of the remote user to get the remote user's audioTrack.
1525
- * @param {STREAM_TYPE_MAIN|STREAM_TYPE_SUB} [config.streamType] - stream type:
1526
- * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (user's microphone)(default)
1527
- * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (user's screen sharing audio). Only works for local screen sharing audio because there is only one remote audioTrack, and there is no distinction between Main and Sub for remote audioTrack.
1528
- * @memberof TRTC
1529
- * @example
1530
- * // Version before v5.4.3
1531
- * trtc.getAudioTrack(); // Get local microphone audioTrack, captured by trtc.startLocalAudio()
1532
- * trtc.getAudioTrack('remoteUserId'); // Get remote audioTrack
1533
- *
1534
- * // Since v5.4.3+, you can get local screen audioTrack by passing the streamType = TRTC.STREAM_TYPE_SUB
1535
- * trtc.getAudioTrack({ streamType: TRTC.STREAM_TYPE_SUB });
1536
- */
1537
- getAudioTrack(configOrUserId?: {
1538
- userId?: string;
1539
- streamType?: TRTCStreamType;
1540
- } | string): MediaStreamTrack | null;
1541
1504
  /**
1542
1505
  * Get video track
1543
1506
  *
@@ -1563,23 +1526,27 @@
1563
1526
  streamType?: TRTCStreamType;
1564
1527
  }): MediaStreamTrack | null;
1565
1528
  /**
1566
- * Get video snapshot <br>
1567
- * Notice: must play the video before it can obtain the snapshot. If there is no playback, an empty string will be returned.
1568
- * @param {string} config.userId - Remote user ID
1569
- * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} config.streamType
1570
- * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream
1571
- * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream
1572
- * @since 5.4.0
1573
- * @example
1574
- * // get self main stream video frame
1575
- * trtc.getVideoSnapshot()
1576
- * // get self sub stream video frame
1577
- * trtc.getVideoSnapshot({streamType:TRTC.TYPE.STREAM_TYPE_SUB})
1578
- * // get remote user main stream video frame
1579
- * trtc.getVideoSnapshot({userId: 'remote userId', streamType:TRTC.TYPE.STREAM_TYPE_MAIN})
1529
+ * Get audio track
1530
+ *
1531
+ * @returns {MediaStreamTrack?} Audio track
1532
+ * @param {Object|string} [config] If not passed, get the local microphone audioTrack
1533
+ * @param {string} [config.userId] If not passed or passed an empty string, get the local audioTrack. Pass the userId of the remote user to get the remote user's audioTrack.
1534
+ * @param {STREAM_TYPE_MAIN|STREAM_TYPE_SUB} [config.streamType] - stream type:
1535
+ * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (user's microphone)(default)
1536
+ * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (user's screen sharing audio). Only works for local screen sharing audio because there is only one remote audioTrack, and there is no distinction between Main and Sub for remote audioTrack.
1580
1537
  * @memberof TRTC
1538
+ * @example
1539
+ * // Version before v5.4.3
1540
+ * trtc.getAudioTrack(); // Get local microphone audioTrack, captured by trtc.startLocalAudio()
1541
+ * trtc.getAudioTrack('remoteUserId'); // Get remote audioTrack
1542
+ *
1543
+ * // Since v5.4.3+, you can get local screen audioTrack by passing the streamType = TRTC.STREAM_TYPE_SUB
1544
+ * trtc.getAudioTrack({ streamType: TRTC.STREAM_TYPE_SUB });
1581
1545
  */
1582
- getVideoSnapshot(config?: VideoFrameConfig): string;
1546
+ getAudioTrack(configOrUserId?: {
1547
+ userId?: string;
1548
+ streamType?: TRTCStreamType;
1549
+ } | string): MediaStreamTrack | null;
1583
1550
  setCurrentSpeaker(speakerId: string): void;
1584
1551
  /**
1585
1552
  * Send SEI Message <br>
@@ -1632,39 +1599,23 @@
1632
1599
  seiPayloadType: number;
1633
1600
  }): void;
1634
1601
  /**
1635
- * Send Custom Message to all remote users in the room. <br>
1636
- *
1637
- * Note:
1638
- *
1639
- * 1. Only {@link module:TYPE.ROLE_ANCHOR TRTC.TYPE.ROLE_ANCHOR} can call sendCustomMessage.
1640
- * 2. You should call this api after {@link TRTC#enterRoom TRTC.enterRoom} successfully.
1641
- * @since v5.6.0
1642
- * @see Listen for the event {@link module:EVENT.CUSTOM_MESSAGE TRTC.EVENT.CUSTOM_MESSAGE} to receive custom message.
1643
- * @param {object} data
1644
- * @param {number} data.cmdId message Id. Integer, range [1, 10]. You can set different cmdId for different types of messages to reduce the delay of transferring message.
1645
- * @param {ArrayBuffer} data.message - message content. <br/>
1646
- * - Maximum 1KB(Byte) sent in a single call.
1647
- * - Maximum 30 calls per second
1648
- * - Maximum 8KB sent per second.
1649
- * @param {boolean} [data.ordered=true] - Send messages in order and as reliably as possible. The receiver will also receive the message in order.
1602
+ * Get video snapshot <br>
1603
+ * Notice: must play the video before it can obtain the snapshot. If there is no playback, an empty string will be returned.
1604
+ * @param {string} config.userId - Remote user ID
1605
+ * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} config.streamType
1606
+ * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream
1607
+ * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream
1608
+ * @since 5.4.0
1650
1609
  * @example
1651
- * // send custom message
1652
- * trtc.sendCustomMessage({
1653
- * cmdId: 1,
1654
- * message: new TextEncoder().encode('hello').buffer,
1655
- * ordered: true,
1656
- * });
1657
- *
1658
- * // receive custom message
1659
- * trtc.on(TRTC.EVENT.CUSTOM_MESSAGE, event => {
1660
- * // event.userId: remote userId.
1661
- * // event.cmdId: message cmdId.
1662
- * // event.seq: message sequence number.
1663
- * // event.message: custom message data, type is ArrayBuffer.
1664
- * console.log(`received custom msg from ${event.userId}, message: ${new TextDecoder().decode(event.message)}`)
1665
- * })
1610
+ * // get self main stream video frame
1611
+ * trtc.getVideoSnapshot()
1612
+ * // get self sub stream video frame
1613
+ * trtc.getVideoSnapshot({streamType:TRTC.TYPE.STREAM_TYPE_SUB})
1614
+ * // get remote user main stream video frame
1615
+ * trtc.getVideoSnapshot({userId: 'remote userId', streamType:TRTC.TYPE.STREAM_TYPE_MAIN})
1616
+ * @memberof TRTC
1666
1617
  */
1667
- sendCustomMessage(data: CustomMessageData): void;
1618
+ getVideoSnapshot(config?: VideoFrameConfig): string;
1668
1619
  static EVENT: {
1669
1620
  readonly ERROR: "error";
1670
1621
  readonly AUTOPLAY_FAILED: "autoplay-failed";
@@ -1686,7 +1637,6 @@
1686
1637
  readonly STATISTICS: "statistics";
1687
1638
  readonly SEI_MESSAGE: "sei-message";
1688
1639
  readonly TRACK: "track";
1689
- readonly CUSTOM_MESSAGE: "custom-message";
1690
1640
  };
1691
1641
  static ERROR_CODE: {
1692
1642
  INVALID_PARAMETER: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-sdk-v5",
3
- "version": "5.6.0-beta.2",
3
+ "version": "5.6.0-beta.4",
4
4
  "description": "Tencent Cloud RTC SDK for Web",
5
5
  "main": "trtc.js",
6
6
  "types": "index.d.ts",