@tencentcloud/tuiroom-engine-js 3.4.3 → 3.4.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
@@ -1738,6 +1738,84 @@ declare enum TUILiveBattleManagerEvents {
1738
1738
  * });
1739
1739
  */
1740
1740
  onBattleRequestReject = "onBattleRequestReject"
1741
+ }
1742
+ /**
1743
+ * 礼物信息
1744
+ */
1745
+ type GiftInfo = {
1746
+ giftID: string;
1747
+ name: string;
1748
+ desc: string;
1749
+ iconUrl: string;
1750
+ resourceUrl: string;
1751
+ level: number;
1752
+ coins: number;
1753
+ extensionInfo: Record<string, string>;
1754
+ };
1755
+ /**
1756
+ * 礼物分类信息
1757
+ */
1758
+ type GiftCategory = {
1759
+ categoryID: string;
1760
+ name: string;
1761
+ desc: string;
1762
+ extensionInfo: Record<string, string>;
1763
+ giftList: GiftInfo[];
1764
+ };
1765
+ declare enum TUILiveGiftManagerEvents {
1766
+ /**
1767
+ * @description 接收到礼物数量发送变化监听事件
1768
+ * @default 'onGiftCountChanged'
1769
+ * @event TUILiveGiftManagerEvents#onGiftCountChanged
1770
+ * @param {object} options
1771
+ * @param {String} roomId 房间Id
1772
+ * @param {Number} totalGiftsSent 总礼物数
1773
+ * @param {Number} totalGiftCoins 总礼物价值
1774
+ * @param {Number} totalUniqueGiftSenders 总礼物发送者数量
1775
+ *
1776
+ * @example
1777
+ * const roomEngine = new TUIRoomEngine();
1778
+ * const liveGiftManager = roomEngine.TUILiveGiftManager();
1779
+ * liveGiftManager.on(TUILiveGiftManagerEvents.onGiftCountChanged, ({ roomId, totalGiftsSent, totalGiftCoins, totalUniqueGiftSenders }) => {
1780
+ * console.log('liveGiftManager.onGiftCountChanged', roomId, totalGiftsSent, totalGiftCoins, totalUniqueGiftSenders);
1781
+ * });
1782
+ */
1783
+ onGiftCountChanged = "onGiftCountChanged",
1784
+ /**
1785
+ * @description 接收到礼物消息的监听事件
1786
+ * @default 'onReceiveGiftMessage'
1787
+ * @event TUILiveGiftManagerEvents#onReceiveGiftMessage
1788
+ * @param {object} options
1789
+ * @param {String} roomId 房间Id
1790
+ * @param {GiftInfo} giftInfo 礼物信息
1791
+ * @param {number} count 礼物数量
1792
+ * @param {TUIUserInfo} sender 发送者信息
1793
+ *
1794
+ * @example
1795
+ * const roomEngine = new TUIRoomEngine();
1796
+ * const liveGiftManager = roomEngine.TUILiveGiftManager();
1797
+ * liveGiftManager.on(TUILiveGiftManagerEvents.onReceiveGiftMessage, ({ roomId, giftInfo, count, sender }) => {
1798
+ * console.log('liveGiftManager.onReceiveGiftMessage', roomId, giftInfo, count, sender);
1799
+ * });
1800
+ */
1801
+ onReceiveGiftMessage = "onReceiveGiftMessage",
1802
+ /**
1803
+ * @description 接收到点赞消息的监听事件
1804
+ * @default 'onReceiveLikesMessage'
1805
+ * @event TUILiveGiftManagerEvents#onReceiveLikesMessage
1806
+ * @param {object} options
1807
+ * @param {String} roomId 房间Id
1808
+ * @param {number} totalLikesReceived 总点赞数
1809
+ * @param {TUIUserInfo} sender 发送者信息
1810
+ *
1811
+ * @example
1812
+ * const roomEngine = new TUIRoomEngine();
1813
+ * const liveGiftManager = roomEngine.TUILiveGiftManager();
1814
+ * liveGiftManager.on(TUILiveGiftManagerEvents.onReceiveLikesMessage, ({ roomId, totalLikesReceived, sender }) => {
1815
+ * console.log('liveGiftManager.onReceiveLikesMessage', roomId, totalLikesReceived, sender);
1816
+ * });
1817
+ */
1818
+ onReceiveLikesMessage = "onReceiveLikesMessage"
1741
1819
  }
1742
1820
 
1743
1821
  declare class Logger {
@@ -2955,6 +3033,151 @@ declare class TUILiveBattleManager {
2955
3033
  private observerFunction;
2956
3034
  }
2957
3035
 
3036
+ declare class TUILiveGiftManager {
3037
+ private liveGiftManagerWASM;
3038
+ private logger;
3039
+ private static liveGiftManager;
3040
+ constructor(options: {
3041
+ Module: any;
3042
+ logger: Logger;
3043
+ roomEngineWASM: any;
3044
+ });
3045
+ /**
3046
+ * 获取礼物列表
3047
+ *
3048
+ * @param {object} options
3049
+ * @param {String} options.roomId 房间ID
3050
+ * @returns {Promise<{giftCategoryList: GiftCategory[]}>}
3051
+ *
3052
+ * @example
3053
+ * const roomEngine = new TUIRoomEngine();
3054
+ * const liveGiftManager = roomEngine.getLiveGiftManager();
3055
+ * liveGiftManager.getGiftList({
3056
+ * roomId: 'roomId'
3057
+ * });
3058
+ */
3059
+ getGiftList(options: {
3060
+ roomId: string;
3061
+ }): Promise<{
3062
+ giftCategoryList: GiftCategory[];
3063
+ }>;
3064
+ /**
3065
+ * 发送礼物
3066
+ *
3067
+ * @param {object} options
3068
+ * @param {string} options.roomId 房间ID
3069
+ * @param {string} options.giftId 礼物ID
3070
+ * @param {number} options.count 礼物数量
3071
+ * @returns {Promise<void>}
3072
+ *
3073
+ * @example
3074
+ * const roomEngine = new TUIRoomEngine();
3075
+ * const liveGiftManager = roomEngine.getLiveGiftManager();
3076
+ * liveGiftManager.sendGift({
3077
+ * roomId: 'roomId',
3078
+ * giftId: 'giftId',
3079
+ * count: 1
3080
+ * });
3081
+ */
3082
+ sendGift(options: {
3083
+ roomId: string;
3084
+ giftId: string;
3085
+ count: number;
3086
+ }): Promise<void>;
3087
+ /**
3088
+ * 发送点赞
3089
+ *
3090
+ * @param {object} options
3091
+ * @param {string} options.roomId 房间ID
3092
+ * @param {number} options.count 点赞数量
3093
+ * @returns {Promise<void>}
3094
+ *
3095
+ * @example
3096
+ * const roomEngine = new TUIRoomEngine();
3097
+ * const liveGiftManager = roomEngine.getLiveGiftManager();
3098
+ * liveGiftManager.sendLikes({
3099
+ * roomId: 'roomId',
3100
+ * count: 1
3101
+ * });
3102
+ */
3103
+ sendLikes(options: {
3104
+ roomId: string;
3105
+ count: number;
3106
+ }): Promise<void>;
3107
+ /**
3108
+ * 获取礼物数量
3109
+ *
3110
+ * @param {object} options
3111
+ * @param {string} options.roomId 房间ID
3112
+ * @returns {Promise<{totalGiftCoins:number, totalGiftsSent: number, totalUniqueGiftSenders: number}>}
3113
+ *
3114
+ * @example
3115
+ * const roomEngine = new TUIRoomEngine();
3116
+ * const liveGiftManager = roomEngine.getLiveGiftManager();
3117
+ * liveGiftManager.getGiftCountByAnchor({
3118
+ * roomId: 'roomId'
3119
+ * });
3120
+ */
3121
+ getGiftCountByAnchor(options: {
3122
+ roomId: string;
3123
+ }): Promise<{
3124
+ totalGiftCoins: number;
3125
+ totalGiftsSent: number;
3126
+ totalUniqueGiftSenders: number;
3127
+ }>;
3128
+ /**
3129
+ * 获取点赞数量
3130
+ *
3131
+ * @param {object} options
3132
+ * @param {string} options.roomId 房间ID
3133
+ * @returns {Promise<{totalLikesReceived: number}>}
3134
+ *
3135
+ * @example
3136
+ * const roomEngine = new TUIRoomEngine();
3137
+ * const liveGiftManager = roomEngine.getLiveGiftManager();
3138
+ * liveGiftManager.getLikesCount({
3139
+ * roomId: 'roomId'
3140
+ * });
3141
+ */
3142
+ getLikesCount(options: {
3143
+ roomId: string;
3144
+ }): Promise<{
3145
+ totalLikesReceived: number;
3146
+ }>;
3147
+ /**
3148
+ * 监听 TUILiveGiftManager 事件
3149
+ * @param {TUILiveGiftManagerEvents} event 事件名
3150
+ * @param func 事件回调函数
3151
+ *
3152
+ * @example
3153
+ * const roomEngine = new TUIRoomEngine();
3154
+ * const liveGiftManager = roomEngine.getLiveGiftManager();
3155
+ *
3156
+ * const callback = ({ roomId, totalGiftsSent, totalGiftCoins, totalUniqueGiftSenders }) => {
3157
+ * console.log('Demo onGiftCountChanged', { roomId, totalGiftsSent, totalGiftCoins, totalUniqueGiftSenders });
3158
+ * }
3159
+ * liveGiftManager.on(TUILiveGiftManagerEvents.onGiftCountChanged, callback);
3160
+ */
3161
+ on(event: TUILiveGiftManagerEvents, func: (...args: any[]) => void): void;
3162
+ /**
3163
+ * 取消监听 TUIliveGiftManager 事件
3164
+ * @param {TUILiveGiftManagerEvents} event 事件名
3165
+ * @param func 事件回调函数
3166
+ *
3167
+ * @example
3168
+ * const roomEngine = new TUIRoomEngine();
3169
+ * const liveGiftManager = roomEngine.getLiveGiftManager();
3170
+ *
3171
+ * const callback = ({ roomId, totalGiftsSent, totalGiftCoins, totalUniqueGiftSenders }) => {
3172
+ * console.log('Demo onGiftCountChanged', { roomId, totalGiftsSent, totalGiftCoins, totalUniqueGiftSenders });
3173
+ * }
3174
+ * liveGiftManager.off(TUILiveGiftManagerEvents.onGiftCountChanged, callback);
3175
+ */
3176
+ off(event: TUILiveGiftManagerEvents, func: (...args: any[]) => void): void;
3177
+ private JSCallNativeFunctionPromise;
3178
+ private observerFunction;
3179
+ }
3180
+
2958
3181
  /**
2959
3182
  * TUIRoomEngine 提供了音视频房间的能力
2960
3183
  *
@@ -2973,6 +3196,7 @@ declare class TUIRoomEngine {
2973
3196
  private liveLayoutManager;
2974
3197
  private liveConnectionManager;
2975
3198
  private liveBattleManager;
3199
+ private liveGiftManager;
2976
3200
  private static userId;
2977
3201
  private static sdkAppId;
2978
3202
  private static Module;
@@ -4454,6 +4678,17 @@ declare class TUIRoomEngine {
4454
4678
  * const liveBattleManager = roomEngine.getLiveBattleManager();
4455
4679
  */
4456
4680
  getLiveBattleManager(): TUILiveBattleManager;
4681
+ /**
4682
+ * v3.4.4 版本起支持 getLiveGiftManager 获取 TUILiveGiftManager 模块
4683
+ *
4684
+ * @since v3.4.4
4685
+ * @returns {TUILiveGiftManager}
4686
+ *
4687
+ * @example
4688
+ * const roomEngine = new TUIRoomEngine();
4689
+ * const liveGiftManager = roomEngine.getLiveGiftManager();
4690
+ */
4691
+ getLiveGiftManager(): TUILiveGiftManager;
4457
4692
  /**
4458
4693
  * v2.6.0 版本起支持使用 getConferenceInvitationManager 获取 conferenceInvitation 模块
4459
4694
  * @since v2.6.0
@@ -4503,5 +4738,5 @@ declare class TUIRoomEngine {
4503
4738
  private static handleSetFramework;
4504
4739
  }
4505
4740
 
4506
- export { TRTCRole, TUIAudioQuality, TUIAudioRoute, TUIBattleCode, TUIBattleStoppedReason, TUICaptureSourceType, TUIChangeReason, TUIConferenceCancelReason, TUIConferenceInvitationManager, TUIConferenceInvitationManagerEvents, TUIConferenceListManager, TUIConferenceListManagerEvents, TUIConferenceStatus, TUIConnectionCode, TUIDeviceStatus, TUIErrorCode, TUIInvitationCode, TUIInvitationRejectedReason, TUIInvitationStatus, TUIKickedOutOfRoomReason, TUILiveBattleManagerEvents, TUILiveConnectionManagerEvents, TUILiveLayoutManager, TUILiveLayoutManagerEvents, TUILiveListManager, TUILiveListManagerEvents, TUILiveModifyFlag, TUIMediaDevice, TUIMediaDeviceState, TUIMediaDeviceType, TUIMoveSeatPolicy, TUINetworkQuality, TUIRenderMode, TUIRequestAction, TUIRequestCallbackType, TUIResolutionMode, TUIRole, TUIRoomDeviceManager, TUIRoomDeviceMangerEvents, TUIRoomDismissedReason, TUIRoomEvents, TUIRoomType, TUISeatMode, TUIVideoQuality, TUIVideoStreamType, TUIRoomEngine as default };
4507
- export type { StartLiveOptions, TUIAutoPlayCallbackInfo, TUIBattleConfig, TUIBattleInfo, TUIBattleUser, TUIConferenceInfo, TUIConferenceModifyInfo, TUIDeviceInfo, TUIEnterRoomOptions, TUIInvitation, TUILiveConnectionUser, TUILiveInfo, TUILiveListResult, TUILiveModifyInfo, TUILiveStatisticsData, TUILoginUserInfo, TUIMessage, TUINetwork, TUIRequest, TUIRequestCallback, TUIRoomInfo, TUISeatInfo, TUISeatLayout, TUISeatLockParams, TUISeatRegion, TUIUserInfo, TUIVideoEncoderParams };
4741
+ export { TRTCRole, TUIAudioQuality, TUIAudioRoute, TUIBattleCode, TUIBattleStoppedReason, TUICaptureSourceType, TUIChangeReason, TUIConferenceCancelReason, TUIConferenceInvitationManager, TUIConferenceInvitationManagerEvents, TUIConferenceListManager, TUIConferenceListManagerEvents, TUIConferenceStatus, TUIConnectionCode, TUIDeviceStatus, TUIErrorCode, TUIInvitationCode, TUIInvitationRejectedReason, TUIInvitationStatus, TUIKickedOutOfRoomReason, TUILiveBattleManagerEvents, TUILiveConnectionManagerEvents, TUILiveGiftManagerEvents, TUILiveLayoutManager, TUILiveLayoutManagerEvents, TUILiveListManager, TUILiveListManagerEvents, TUILiveModifyFlag, TUIMediaDevice, TUIMediaDeviceState, TUIMediaDeviceType, TUIMoveSeatPolicy, TUINetworkQuality, TUIRenderMode, TUIRequestAction, TUIRequestCallbackType, TUIResolutionMode, TUIRole, TUIRoomDeviceManager, TUIRoomDeviceMangerEvents, TUIRoomDismissedReason, TUIRoomEvents, TUIRoomType, TUISeatMode, TUIVideoQuality, TUIVideoStreamType, TUIRoomEngine as default };
4742
+ export type { GiftCategory, GiftInfo, StartLiveOptions, TUIAutoPlayCallbackInfo, TUIBattleConfig, TUIBattleInfo, TUIBattleUser, TUIConferenceInfo, TUIConferenceModifyInfo, TUIDeviceInfo, TUIEnterRoomOptions, TUIInvitation, TUILiveConnectionUser, TUILiveInfo, TUILiveListResult, TUILiveModifyInfo, TUILiveStatisticsData, TUILoginUserInfo, TUIMessage, TUINetwork, TUIRequest, TUIRequestCallback, TUIRoomInfo, TUISeatInfo, TUISeatLayout, TUISeatLockParams, TUISeatRegion, TUIUserInfo, TUIVideoEncoderParams };