trtc-electron-sdk 13.3.801-alpha.3 → 13.3.801

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.
@@ -620,11 +620,11 @@ class TRTCMediaMixingManager {
620
620
  getAddMediaSourceTimeoutMs(sourceType) {
621
621
  switch (sourceType) {
622
622
  case types_1.TRTCMediaSourceType.kOnlineVideo:
623
- return 15000;
623
+ return 11000;
624
624
  case types_1.TRTCMediaSourceType.kVideoFile:
625
- return 10000;
625
+ return 6000;
626
626
  default:
627
- return 8000;
627
+ return 5000;
628
628
  }
629
629
  }
630
630
  /**
package/liteav/trtc.d.ts CHANGED
@@ -1167,7 +1167,6 @@ declare class TRTCCloud extends EventEmitter implements ITRTCCloud {
1167
1167
  * 该接口跟 startPublishing() 类似,但 startPublishCDNStream() 支持向非腾讯云的直播 CDN 转推。
1168
1168
  *
1169
1169
  * 注意:
1170
- * - 使用 startPublishing() 绑定腾讯云直播 CDN 不收取额外的费用。
1171
1170
  * - 使用 startPublishCDNStream() 绑定非腾讯云直播 CDN 需要收取转推费用,且需要通过工单联系我们开通。
1172
1171
  *
1173
1172
  * @param {TRTCPublishCDNParam} param - 转推参数
package/liteav/trtc.js CHANGED
@@ -2097,7 +2097,6 @@ class TRTCCloud extends events_1.EventEmitter {
2097
2097
  * 该接口跟 startPublishing() 类似,但 startPublishCDNStream() 支持向非腾讯云的直播 CDN 转推。
2098
2098
  *
2099
2099
  * 注意:
2100
- * - 使用 startPublishing() 绑定腾讯云直播 CDN 不收取额外的费用。
2101
2100
  * - 使用 startPublishCDNStream() 绑定非腾讯云直播 CDN 需要收取转推费用,且需要通过工单联系我们开通。
2102
2101
  *
2103
2102
  * @param {TRTCPublishCDNParam} param - 转推参数
@@ -1125,85 +1125,3 @@ export interface TRTCInitConfig {
1125
1125
  };
1126
1126
  isIPCMode?: boolean;
1127
1127
  }
1128
- /**
1129
- * @namespace TRTCVodPlayerEvent
1130
- * @description 点播播放器(VOD Player)事件
1131
- */
1132
- export declare enum TRTCVodPlayerEvent {
1133
- /**
1134
- * @description 多媒体文件开始播放事件
1135
- *
1136
- * @event TRTCVodPlayerEvent#onVodPlayerStarted
1137
- * @param {Number} msLength 多媒体文件总长度,单位毫秒
1138
- */
1139
- onVodPlayerStarted = "onVodPlayerStarted",
1140
- /**
1141
- * @description 播放器就绪事件
1142
- *
1143
- * 调用 `preload()` 完成后触发,或 `switchSource()` 切换成功后触发。
1144
- *
1145
- * @event TRTCVodPlayerEvent#onVodPlayerLoaded
1146
- * @param {Number} durationMs 视频总时长,单位毫秒
1147
- * @param {Number} width 视频宽度(像素),纯音频文件时为 0
1148
- * @param {Number} height 视频高度(像素),纯音频文件时为 0
1149
- */
1150
- onVodPlayerLoaded = "onVodPlayerLoaded",
1151
- /**
1152
- * @description 多媒体文件播放进度改变事件
1153
- *
1154
- * @event TRTCVodPlayerEvent#onVodPlayerProgress
1155
- * @param {Number} msPos 多媒体文件当前播放进度,单位毫秒
1156
- */
1157
- onVodPlayerProgress = "onVodPlayerProgress",
1158
- /**
1159
- * @description 多媒体文件播放暂停事件
1160
- *
1161
- * @event TRTCVodPlayerEvent#onVodPlayerPaused
1162
- */
1163
- onVodPlayerPaused = "onVodPlayerPaused",
1164
- /**
1165
- * @description 多媒体文件播放恢复事件
1166
- *
1167
- * @event TRTCVodPlayerEvent#onVodPlayerResumed
1168
- */
1169
- onVodPlayerResumed = "onVodPlayerResumed",
1170
- /**
1171
- * @description 多媒体文件播放停止事件
1172
- *
1173
- * @event TRTCVodPlayerEvent#onVodPlayerStopped
1174
- * @param {Number} reason 停止原因
1175
- * - 0:用户主动停止;
1176
- * - 1:文件播放完;
1177
- * - 2:视频断流。
1178
- */
1179
- onVodPlayerStopped = "onVodPlayerStopped",
1180
- /**
1181
- * @description 多媒体文件播放出错事件
1182
- *
1183
- * @event TRTCVodPlayerEvent#onVodPlayerError
1184
- * @param {Number} error 错误码
1185
- * - -6001:未知错误;
1186
- * - -6002:通用错误;
1187
- * - -6003:解封装失败;
1188
- * - -6005:解封装超时;
1189
- * - -6006:视频解码错误;
1190
- * - -6007:音频解码错误;
1191
- * - -6009:视频渲染错误。
1192
- */
1193
- onVodPlayerError = "onVodPlayerError"
1194
- }
1195
- /**
1196
- * 点播播放器事件监听器类型定义
1197
- *
1198
- * key 为 {@link TRTCVodPlayerEvent},value 为该事件回调接收的参数元组。
1199
- * 用于在 TS 层实现事件名到回调参数的精确类型映射,避免 any 滥用。
1200
- */
1201
- export interface TRTCVodPlayerEventMap {
1202
- [TRTCVodPlayerEvent.onVodPlayerStarted]: [msLength: number];
1203
- [TRTCVodPlayerEvent.onVodPlayerLoaded]: [durationMs: number, width: number, height: number];
1204
- [TRTCVodPlayerEvent.onVodPlayerProgress]: [msPos: number];
1205
- [TRTCVodPlayerEvent.onVodPlayerPaused]: [];
1206
- [TRTCVodPlayerEvent.onVodPlayerResumed]: [];
1207
- [TRTCVodPlayerEvent.onVodPlayerStopped]: [reason: number];
1208
- [TRTCVodPlayerEvent.onVodPlayerError]: [error: number];
1209
- }
@@ -7,7 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.TRTCTranscodingConfig = exports.TRTCPluginType = exports.TRTCVoiceChangerType = exports.TRTCVoiceReverbType = exports.TRTCPublishMode = exports.TRTCAudioRecordingContent = exports.TRTCMixInputType = exports.TRTCTranscodingConfigMode = exports.TRTCMixUser = exports.Rect = exports.TRTCSpeedTestResult = exports.TRTCSpeedTestParams = exports.TRTCVolumeInfo = exports.TRTCQualityInfo = exports.TRTCNetworkQosParam = exports.TRTCRenderParams = exports.TRTCVideoEncParam = exports.TRTCParams = exports.TRTCWaterMarkSrcType = exports.TRTCVideoEncodeComplexity = exports.TRTCVideoColorSpace = exports.TRTCVideoColorRange = exports.TRTCCameraCaptureMode = exports.TRTCDeviceType = exports.TRTCDeviceState = exports.TRTCLogLevel = exports.TRTCAudioFrame = exports.TRTCVideoFrame = exports.TRTCDeviceInfo = exports.TRTCScreenCaptureProperty = exports.TRTCScreenCaptureSourceInfo = exports.TRTCImageBuffer = exports.TRTCAudioQuality = exports.TRTCScreenCaptureSourceType = exports.TRTCAudioFrameFormat = exports.TRTCVideoQosPreference = exports.TRTCQosControlMode = exports.TRTCRoleType = exports.TRTCAppScene = exports.TRTCRecordType = exports.TRTCVideoMirrorType = exports.TRTCVideoBufferType = exports.TRTCVideoPixelFormat = exports.TRTCBeautyStyle = exports.TRTCVideoRotation = exports.TRTCVideoFillMode = exports.TRTCQuality = exports.TRTCVideoStreamType = exports.TRTCVideoResolutionMode = exports.TRTCVideoResolution = void 0;
10
- exports.TRTCVodPlayerEvent = exports.VideoBufferInfo = exports.TRTCSwitchRoomParam = exports.AudioMusicParam = exports.TRTCStatistics = exports.TRTCRemoteStatistics = exports.TRTCLocalStatistics = exports.TRTCAudioEffectParam = exports.TRTCAudioRecordingParams = exports.TRTCPublishCDNParam = void 0;
10
+ exports.VideoBufferInfo = exports.TRTCSwitchRoomParam = exports.AudioMusicParam = exports.TRTCStatistics = exports.TRTCRemoteStatistics = exports.TRTCLocalStatistics = exports.TRTCAudioEffectParam = exports.TRTCAudioRecordingParams = exports.TRTCPublishCDNParam = void 0;
11
11
  const util_1 = require("./Renderer/util");
12
12
  /////////////////////////////////////////////////////////////////////////////////
13
13
  //
@@ -2032,76 +2032,3 @@ class VideoBufferInfo {
2032
2032
  }
2033
2033
  }
2034
2034
  exports.VideoBufferInfo = VideoBufferInfo;
2035
- /////////////////////////////////////////////////////////////////////////////////
2036
- //
2037
- // TRTCVodPlayer 相关类型定义
2038
- //
2039
- /////////////////////////////////////////////////////////////////////////////////
2040
- /**
2041
- * @namespace TRTCVodPlayerEvent
2042
- * @description 点播播放器(VOD Player)事件
2043
- */
2044
- var TRTCVodPlayerEvent;
2045
- (function (TRTCVodPlayerEvent) {
2046
- /**
2047
- * @description 多媒体文件开始播放事件
2048
- *
2049
- * @event TRTCVodPlayerEvent#onVodPlayerStarted
2050
- * @param {Number} msLength 多媒体文件总长度,单位毫秒
2051
- */
2052
- TRTCVodPlayerEvent["onVodPlayerStarted"] = "onVodPlayerStarted";
2053
- /**
2054
- * @description 播放器就绪事件
2055
- *
2056
- * 调用 `preload()` 完成后触发,或 `switchSource()` 切换成功后触发。
2057
- *
2058
- * @event TRTCVodPlayerEvent#onVodPlayerLoaded
2059
- * @param {Number} durationMs 视频总时长,单位毫秒
2060
- * @param {Number} width 视频宽度(像素),纯音频文件时为 0
2061
- * @param {Number} height 视频高度(像素),纯音频文件时为 0
2062
- */
2063
- TRTCVodPlayerEvent["onVodPlayerLoaded"] = "onVodPlayerLoaded";
2064
- /**
2065
- * @description 多媒体文件播放进度改变事件
2066
- *
2067
- * @event TRTCVodPlayerEvent#onVodPlayerProgress
2068
- * @param {Number} msPos 多媒体文件当前播放进度,单位毫秒
2069
- */
2070
- TRTCVodPlayerEvent["onVodPlayerProgress"] = "onVodPlayerProgress";
2071
- /**
2072
- * @description 多媒体文件播放暂停事件
2073
- *
2074
- * @event TRTCVodPlayerEvent#onVodPlayerPaused
2075
- */
2076
- TRTCVodPlayerEvent["onVodPlayerPaused"] = "onVodPlayerPaused";
2077
- /**
2078
- * @description 多媒体文件播放恢复事件
2079
- *
2080
- * @event TRTCVodPlayerEvent#onVodPlayerResumed
2081
- */
2082
- TRTCVodPlayerEvent["onVodPlayerResumed"] = "onVodPlayerResumed";
2083
- /**
2084
- * @description 多媒体文件播放停止事件
2085
- *
2086
- * @event TRTCVodPlayerEvent#onVodPlayerStopped
2087
- * @param {Number} reason 停止原因
2088
- * - 0:用户主动停止;
2089
- * - 1:文件播放完;
2090
- * - 2:视频断流。
2091
- */
2092
- TRTCVodPlayerEvent["onVodPlayerStopped"] = "onVodPlayerStopped";
2093
- /**
2094
- * @description 多媒体文件播放出错事件
2095
- *
2096
- * @event TRTCVodPlayerEvent#onVodPlayerError
2097
- * @param {Number} error 错误码
2098
- * - -6001:未知错误;
2099
- * - -6002:通用错误;
2100
- * - -6003:解封装失败;
2101
- * - -6005:解封装超时;
2102
- * - -6006:视频解码错误;
2103
- * - -6007:音频解码错误;
2104
- * - -6009:视频渲染错误。
2105
- */
2106
- TRTCVodPlayerEvent["onVodPlayerError"] = "onVodPlayerError";
2107
- })(TRTCVodPlayerEvent = exports.TRTCVodPlayerEvent || (exports.TRTCVodPlayerEvent = {}));
package/liteav/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import TRTCMediaMixingManager, { TRTCMediaMixingService } from './extensions/MediaMixingManager';
2
- import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceType, TRTCLogLevel, TRTCAudioFrame, TRTCVideoFillMode, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCVoiceChangerType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions, TRTCPublishTarget, TRTCStreamEncoderParam, TRTCStreamMixingConfig, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoFrame, TRTCVideoPixelFormat, TRTCVideoBufferType, TRTCVodPlayerEventMap } from './trtc_define';
2
+ import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceType, TRTCLogLevel, TRTCAudioFrame, TRTCVideoFillMode, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCVoiceChangerType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions, TRTCPublishTarget, TRTCStreamEncoderParam, TRTCStreamMixingConfig, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoFrame, TRTCVideoPixelFormat, TRTCVideoBufferType } from './trtc_define';
3
+ import { TRTCVodPlayerEventMap } from './vod_player';
3
4
  export interface TRTCVideoRenderCallback {
4
5
  onRenderVideoFrame(userId: string, streamType: TRTCVideoStreamType, frame: TRTCVideoFrame): void;
5
6
  }
@@ -1,5 +1,87 @@
1
- import { TRTCVideoRotation, TRTCVideoFillMode, TRTCVodPlayerEventMap } from './trtc_define';
1
+ import { TRTCVideoRotation, TRTCVideoFillMode } from './trtc_define';
2
2
  import { IVodPlayer } from './types';
3
+ /**
4
+ * @namespace TRTCVodPlayerEvent
5
+ * @description 点播播放器(VOD Player)事件
6
+ */
7
+ export declare enum TRTCVodPlayerEvent {
8
+ /**
9
+ * @description 多媒体文件开始播放事件
10
+ *
11
+ * @event TRTCVodPlayerEvent#onVodPlayerStarted
12
+ * @param {Number} msLength 多媒体文件总长度,单位毫秒
13
+ */
14
+ onVodPlayerStarted = "onVodPlayerStarted",
15
+ /**
16
+ * @description 播放器就绪事件
17
+ *
18
+ * 调用 `preload()` 完成后触发,或 `switchSource()` 切换成功后触发。
19
+ *
20
+ * @event TRTCVodPlayerEvent#onVodPlayerLoaded
21
+ * @param {Number} durationMs 视频总时长,单位毫秒
22
+ * @param {Number} width 视频宽度(像素),纯音频文件时为 0
23
+ * @param {Number} height 视频高度(像素),纯音频文件时为 0
24
+ */
25
+ onVodPlayerLoaded = "onVodPlayerLoaded",
26
+ /**
27
+ * @description 多媒体文件播放进度改变事件
28
+ *
29
+ * @event TRTCVodPlayerEvent#onVodPlayerProgress
30
+ * @param {Number} msPos 多媒体文件当前播放进度,单位毫秒
31
+ */
32
+ onVodPlayerProgress = "onVodPlayerProgress",
33
+ /**
34
+ * @description 多媒体文件播放暂停事件
35
+ *
36
+ * @event TRTCVodPlayerEvent#onVodPlayerPaused
37
+ */
38
+ onVodPlayerPaused = "onVodPlayerPaused",
39
+ /**
40
+ * @description 多媒体文件播放恢复事件
41
+ *
42
+ * @event TRTCVodPlayerEvent#onVodPlayerResumed
43
+ */
44
+ onVodPlayerResumed = "onVodPlayerResumed",
45
+ /**
46
+ * @description 多媒体文件播放停止事件
47
+ *
48
+ * @event TRTCVodPlayerEvent#onVodPlayerStopped
49
+ * @param {Number} reason 停止原因
50
+ * - 0:用户主动停止;
51
+ * - 1:文件播放完;
52
+ * - 2:视频断流。
53
+ */
54
+ onVodPlayerStopped = "onVodPlayerStopped",
55
+ /**
56
+ * @description 多媒体文件播放出错事件
57
+ *
58
+ * @event TRTCVodPlayerEvent#onVodPlayerError
59
+ * @param {Number} error 错误码
60
+ * - -6001:未知错误;
61
+ * - -6002:通用错误;
62
+ * - -6003:解封装失败;
63
+ * - -6005:解封装超时;
64
+ * - -6006:视频解码错误;
65
+ * - -6007:音频解码错误;
66
+ * - -6009:视频渲染错误。
67
+ */
68
+ onVodPlayerError = "onVodPlayerError"
69
+ }
70
+ /**
71
+ * 点播播放器事件监听器类型定义
72
+ *
73
+ * key 为 {@link TRTCVodPlayerEvent},value 为该事件回调接收的参数元组。
74
+ * 用于在 TS 层实现事件名到回调参数的精确类型映射,避免 any 滥用。
75
+ */
76
+ export interface TRTCVodPlayerEventMap {
77
+ [TRTCVodPlayerEvent.onVodPlayerStarted]: [msLength: number];
78
+ [TRTCVodPlayerEvent.onVodPlayerLoaded]: [durationMs: number, width: number, height: number];
79
+ [TRTCVodPlayerEvent.onVodPlayerProgress]: [msPos: number];
80
+ [TRTCVodPlayerEvent.onVodPlayerPaused]: [];
81
+ [TRTCVodPlayerEvent.onVodPlayerResumed]: [];
82
+ [TRTCVodPlayerEvent.onVodPlayerStopped]: [reason: number];
83
+ [TRTCVodPlayerEvent.onVodPlayerError]: [error: number];
84
+ }
3
85
  /**
4
86
  *
5
87
  * 腾讯云点播播放器
@@ -125,8 +207,6 @@ export declare class TRTCVodPlayer implements IVodPlayer {
125
207
  * 重复调用会被忽略。
126
208
  *
127
209
  * @note 可以先调用 {@link preload} 预加载完成后再调用 start,也可以跳过 preload 直接调用 start。
128
- * @note 从 SDK 10.7 版本开始,需要通过 TXLiveBase#setLicence 设置 Licence 后方可成功播放,
129
- * 否则将播放失败(黑屏),全局仅设置一次即可。
130
210
  */
131
211
  start(): void;
132
212
  /**
@@ -154,14 +234,19 @@ export declare class TRTCVodPlayer implements IVodPlayer {
154
234
  */
155
235
  seek(msPos: number): void;
156
236
  /**
157
- * 无缝切换当前播放的媒体文件
237
+ * 切换当前播放的媒体文件
238
+ *
239
+ * 底层实现等价于 `stop + 加载新源`,**切换后是否自动播放取决于切换前的状态**:
240
+ * - 切换前在播放中:底层会自动 Started 新源,业务方无需再调 {@link start};
241
+ * - 切换前在暂停中:底层只 Loaded 新源不自动播放,业务方需在
242
+ * {@link TRTCVodPlayerEvent.onVodPlayerLoaded} 之后调 {@link start} 才会播。
158
243
  *
159
- * 在后台预加载新的媒体源,待新源就绪后无缝切换,避免切换时出现黑屏。
160
- * 切换成功后触发 {@link TRTCVodPlayerEvent.onVodPlayerLoaded} 事件,携带新文件的媒体信息。
244
+ * 切换过程中会按顺序触发:
245
+ * `onVodPlayerStopped` `onVodPlayerLoaded`(新源信息)
246
+ * `onVodPlayerStarted`(仅"切换前在播放中"路径才会有)。
161
247
  *
162
248
  * @param newMediaFile - 新的媒体文件路径或 URL
163
249
  *
164
- * @note 若当前处于暂停状态,切换后仍保持暂停并展示新文件第一帧。
165
250
  * @note 切换过程中调用 {@link stop} 会取消切换并停止当前播放。
166
251
  * @note 调用前必须先 {@link preload} 或 {@link start},否则会被忽略并打 warn 日志。
167
252
  * @note 传入空串会被忽略并打 warn 日志(C++ 层亦有同等保护)。
@@ -1,11 +1,84 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TRTCVodPlayer = void 0;
3
+ exports.TRTCVodPlayer = exports.TRTCVodPlayerEvent = void 0;
4
4
  const events_1 = require("events");
5
5
  const trtc_define_1 = require("./trtc_define");
6
6
  const video_render_1 = require("./Live/video-render");
7
7
  const logger_1 = require("./logger");
8
8
  const NodeTRTCEngine = require('../build/Release/trtc_electron_sdk.node');
9
+ /////////////////////////////////////////////////////////////////////////////////
10
+ //
11
+ // TRTCVodPlayer 相关类型定义
12
+ //
13
+ /////////////////////////////////////////////////////////////////////////////////
14
+ /**
15
+ * @namespace TRTCVodPlayerEvent
16
+ * @description 点播播放器(VOD Player)事件
17
+ */
18
+ var TRTCVodPlayerEvent;
19
+ (function (TRTCVodPlayerEvent) {
20
+ /**
21
+ * @description 多媒体文件开始播放事件
22
+ *
23
+ * @event TRTCVodPlayerEvent#onVodPlayerStarted
24
+ * @param {Number} msLength 多媒体文件总长度,单位毫秒
25
+ */
26
+ TRTCVodPlayerEvent["onVodPlayerStarted"] = "onVodPlayerStarted";
27
+ /**
28
+ * @description 播放器就绪事件
29
+ *
30
+ * 调用 `preload()` 完成后触发,或 `switchSource()` 切换成功后触发。
31
+ *
32
+ * @event TRTCVodPlayerEvent#onVodPlayerLoaded
33
+ * @param {Number} durationMs 视频总时长,单位毫秒
34
+ * @param {Number} width 视频宽度(像素),纯音频文件时为 0
35
+ * @param {Number} height 视频高度(像素),纯音频文件时为 0
36
+ */
37
+ TRTCVodPlayerEvent["onVodPlayerLoaded"] = "onVodPlayerLoaded";
38
+ /**
39
+ * @description 多媒体文件播放进度改变事件
40
+ *
41
+ * @event TRTCVodPlayerEvent#onVodPlayerProgress
42
+ * @param {Number} msPos 多媒体文件当前播放进度,单位毫秒
43
+ */
44
+ TRTCVodPlayerEvent["onVodPlayerProgress"] = "onVodPlayerProgress";
45
+ /**
46
+ * @description 多媒体文件播放暂停事件
47
+ *
48
+ * @event TRTCVodPlayerEvent#onVodPlayerPaused
49
+ */
50
+ TRTCVodPlayerEvent["onVodPlayerPaused"] = "onVodPlayerPaused";
51
+ /**
52
+ * @description 多媒体文件播放恢复事件
53
+ *
54
+ * @event TRTCVodPlayerEvent#onVodPlayerResumed
55
+ */
56
+ TRTCVodPlayerEvent["onVodPlayerResumed"] = "onVodPlayerResumed";
57
+ /**
58
+ * @description 多媒体文件播放停止事件
59
+ *
60
+ * @event TRTCVodPlayerEvent#onVodPlayerStopped
61
+ * @param {Number} reason 停止原因
62
+ * - 0:用户主动停止;
63
+ * - 1:文件播放完;
64
+ * - 2:视频断流。
65
+ */
66
+ TRTCVodPlayerEvent["onVodPlayerStopped"] = "onVodPlayerStopped";
67
+ /**
68
+ * @description 多媒体文件播放出错事件
69
+ *
70
+ * @event TRTCVodPlayerEvent#onVodPlayerError
71
+ * @param {Number} error 错误码
72
+ * - -6001:未知错误;
73
+ * - -6002:通用错误;
74
+ * - -6003:解封装失败;
75
+ * - -6005:解封装超时;
76
+ * - -6006:视频解码错误;
77
+ * - -6007:音频解码错误;
78
+ * - -6009:视频渲染错误。
79
+ */
80
+ TRTCVodPlayerEvent["onVodPlayerError"] = "onVodPlayerError";
81
+ })(TRTCVodPlayerEvent = exports.TRTCVodPlayerEvent || (exports.TRTCVodPlayerEvent = {}));
9
82
  /**
10
83
  *
11
84
  * 腾讯云点播播放器
@@ -176,8 +249,6 @@ class TRTCVodPlayer {
176
249
  * 重复调用会被忽略。
177
250
  *
178
251
  * @note 可以先调用 {@link preload} 预加载完成后再调用 start,也可以跳过 preload 直接调用 start。
179
- * @note 从 SDK 10.7 版本开始,需要通过 TXLiveBase#setLicence 设置 Licence 后方可成功播放,
180
- * 否则将播放失败(黑屏),全局仅设置一次即可。
181
252
  */
182
253
  start() {
183
254
  var _a;
@@ -272,14 +343,19 @@ class TRTCVodPlayer {
272
343
  (_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.seek(msPos);
273
344
  }
274
345
  /**
275
- * 无缝切换当前播放的媒体文件
346
+ * 切换当前播放的媒体文件
347
+ *
348
+ * 底层实现等价于 `stop + 加载新源`,**切换后是否自动播放取决于切换前的状态**:
349
+ * - 切换前在播放中:底层会自动 Started 新源,业务方无需再调 {@link start};
350
+ * - 切换前在暂停中:底层只 Loaded 新源不自动播放,业务方需在
351
+ * {@link TRTCVodPlayerEvent.onVodPlayerLoaded} 之后调 {@link start} 才会播。
276
352
  *
277
- * 在后台预加载新的媒体源,待新源就绪后无缝切换,避免切换时出现黑屏。
278
- * 切换成功后触发 {@link TRTCVodPlayerEvent.onVodPlayerLoaded} 事件,携带新文件的媒体信息。
353
+ * 切换过程中会按顺序触发:
354
+ * `onVodPlayerStopped` `onVodPlayerLoaded`(新源信息)
355
+ * `onVodPlayerStarted`(仅"切换前在播放中"路径才会有)。
279
356
  *
280
357
  * @param newMediaFile - 新的媒体文件路径或 URL
281
358
  *
282
- * @note 若当前处于暂停状态,切换后仍保持暂停并展示新文件第一帧。
283
359
  * @note 切换过程中调用 {@link stop} 会取消切换并停止当前播放。
284
360
  * @note 调用前必须先 {@link preload} 或 {@link start},否则会被忽略并打 warn 日志。
285
361
  * @note 传入空串会被忽略并打 warn 日志(C++ 层亦有同等保护)。
@@ -621,29 +697,36 @@ class TRTCVodPlayer {
621
697
  _initEventCallback() {
622
698
  var _a;
623
699
  (_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.setEventCallback((args) => {
624
- switch (args[0]) {
625
- case trtc_define_1.TRTCVodPlayerEvent.onVodPlayerStarted:
626
- this.fire(trtc_define_1.TRTCVodPlayerEvent.onVodPlayerStarted, args[1].msLength);
700
+ const event = args[0];
701
+ if ((event === TRTCVodPlayerEvent.onVodPlayerStopped || event === TRTCVodPlayerEvent.onVodPlayerError) && this.isStarted) {
702
+ this.isStarted = false;
703
+ }
704
+ switch (event) {
705
+ case TRTCVodPlayerEvent.onVodPlayerStarted:
706
+ if (!this.isStarted) {
707
+ this.isStarted = true;
708
+ }
709
+ this.fire(TRTCVodPlayerEvent.onVodPlayerStarted, args[1].msLength);
627
710
  break;
628
- case trtc_define_1.TRTCVodPlayerEvent.onVodPlayerLoaded: {
711
+ case TRTCVodPlayerEvent.onVodPlayerLoaded: {
629
712
  const data = args[1];
630
- this.fire(trtc_define_1.TRTCVodPlayerEvent.onVodPlayerLoaded, data.durationMs, data.width, data.height);
713
+ this.fire(TRTCVodPlayerEvent.onVodPlayerLoaded, data.durationMs, data.width, data.height);
631
714
  break;
632
715
  }
633
- case trtc_define_1.TRTCVodPlayerEvent.onVodPlayerProgress:
634
- this.fire(trtc_define_1.TRTCVodPlayerEvent.onVodPlayerProgress, args[1].msPos);
716
+ case TRTCVodPlayerEvent.onVodPlayerProgress:
717
+ this.fire(TRTCVodPlayerEvent.onVodPlayerProgress, args[1].msPos);
635
718
  break;
636
- case trtc_define_1.TRTCVodPlayerEvent.onVodPlayerPaused:
637
- this.fire(trtc_define_1.TRTCVodPlayerEvent.onVodPlayerPaused);
719
+ case TRTCVodPlayerEvent.onVodPlayerPaused:
720
+ this.fire(TRTCVodPlayerEvent.onVodPlayerPaused);
638
721
  break;
639
- case trtc_define_1.TRTCVodPlayerEvent.onVodPlayerResumed:
640
- this.fire(trtc_define_1.TRTCVodPlayerEvent.onVodPlayerResumed);
722
+ case TRTCVodPlayerEvent.onVodPlayerResumed:
723
+ this.fire(TRTCVodPlayerEvent.onVodPlayerResumed);
641
724
  break;
642
- case trtc_define_1.TRTCVodPlayerEvent.onVodPlayerStopped:
643
- this.fire(trtc_define_1.TRTCVodPlayerEvent.onVodPlayerStopped, args[1].reason);
725
+ case TRTCVodPlayerEvent.onVodPlayerStopped:
726
+ this.fire(TRTCVodPlayerEvent.onVodPlayerStopped, args[1].reason);
644
727
  break;
645
- case trtc_define_1.TRTCVodPlayerEvent.onVodPlayerError:
646
- this.fire(trtc_define_1.TRTCVodPlayerEvent.onVodPlayerError, args[1].error);
728
+ case TRTCVodPlayerEvent.onVodPlayerError:
729
+ this.fire(TRTCVodPlayerEvent.onVodPlayerError, args[1].error);
647
730
  break;
648
731
  default: {
649
732
  const exhaustiveCheck = args[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "13.3.801-alpha.3",
3
+ "version": "13.3.801",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",