@volcengine/vepusher 2.0.4-rc.7 → 2.0.4-rc.8

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.
@@ -53,120 +53,8 @@ declare type ConfigOptions = {
53
53
  * - `webTransport`: Streaming with WebTransport protocol.
54
54
  */
55
55
  mode?: PushMode;
56
- /** {zh}
57
- * @brief 推流中断重试配置,包含是否开启,重试最大超时时间,不传入时默认开启断线重连,最大超时时间默认3分钟
58
- */
59
- /** {en}
60
- * @brief Push stream interruption retry configuration, including whether to enable, maximum retry timeout time, and default to enabling reconnection, maximum timeout time default 3 minutes.
61
- */
62
- reconnectConfig?: {
63
- /** {zh}
64
- * @brief 是否开启断线重连。
65
- */
66
- /** {en}
67
- * @brief Whether to enable reconnection after disconnection.
68
- */
69
- enable: boolean;
70
- /** {zh}
71
- * @brief 最大重试超时时间,单位为秒。
72
- */
73
- /** {en}
74
- * @brief Maximum retry timeout time, in seconds.
75
- */
76
- maxTimeout?: number;
77
- };
78
- /** {zh}
79
- * @brief 推流日志配置, 默认自动开启日志上报。
80
- */
81
- /** {en}
82
- * @brief Streaming log configuration, default automatic log reporting.
83
- */
84
- loggerConfig?: {
85
- /** {zh}
86
- * @brief 是否开启日志上报。
87
- */
88
- /** {en}
89
- * @brief Whether to enable log reporting.
90
- */
91
- enable: boolean;
92
- /** {zh}
93
- * @brief 火山引擎的账号id,用于日志上报排查。
94
- */
95
- /** {en}
96
- * @brief Byteplus account ID for log reporting.
97
- */
98
- accountId: number;
99
- /** {zh}
100
- * @brief 应用 ID。登录视频直播控制台 > SDK 管理查询。
101
- */
102
- /** {en}
103
- * @brief Application ID. Query in the SDK Management section of the Byteplus MediaLive Broadcast Console.
104
- */
105
- appId?: number;
106
- /** {zh}
107
- * @brief 应用名称。
108
- */
109
- /** {en}
110
- * @brief Application name.
111
- */
112
- appName?: string;
113
- /** {zh}
114
- * @brief 用于识别单一用户的 ID,如不设置,会随机生成一个用户 ID 存在浏览器缓存中。
115
- */
116
- /** {en}
117
- * @brief User ID for identifying a single user. If not set, a random user ID will be generated and stored in the browser cache.
118
- */
119
- userId?: string;
120
- /** {zh}
121
- * @brief 用于识别用户设备的 ID,如不设置,会随机生成一个用户 ID 存在浏览器缓存中。
122
- */
123
- /** {en}
124
- * @brief User device ID. If not set, a random user ID will be generated and stored in the browser cache.
125
- */
126
- deviceId?: string;
127
- showInConsole?: boolean;
128
- };
129
- checkAudio?: boolean;
130
56
  };
131
57
 
132
- /** {zh}
133
- * @detail events
134
- * @brief 直播链接状态码
135
- */
136
- /** {en}
137
- *
138
- */
139
- declare enum ConnectionState {
140
- /** {zh}
141
- * @brief 断开连接,默认时断开连接。
142
- */
143
- /** {en}
144
- * @brief Disconnected by default.
145
- */
146
- DISCONNECTED = 0,
147
- /** {zh}
148
- * @brief 连接中。
149
- */
150
- /** {en}
151
- * @brief Connecting.
152
- */
153
- CONNECTING = 1,
154
- /** {zh}
155
- * @brief 已连接。
156
- */
157
- /** {en}
158
- * @brief Connected.
159
- */
160
- CONNECTED = 2,
161
- /** {zh}
162
- * @brief 重连中。
163
- */
164
- /** {en}
165
- * @brief Reconnecting.
166
- */
167
- RECONNECTING = 3,
168
- }
169
-
170
58
  /** {zh}
171
59
  * @detail config
172
60
  * @list config
@@ -292,31 +180,21 @@ declare interface IProperty {
292
180
  */
293
181
  setVideoFps: number;
294
182
  /** {zh}
295
- * @deprecated
296
- * @brief 设置推流视频的码率,单位为 bps。
183
+ * @brief 设置推流视频的码率,单位为 kbps。
297
184
  */
298
185
  /** {en}
299
- * @deprecated
300
- * @brief Set the push stream video bitrate in bps.
186
+ *
187
+ * @brief Set the push stream video bitrate in kbps.
301
188
  */
302
189
  setVideoBitrate: number;
303
190
  /** {zh}
304
- * @brief 设置推流时视频的码率,单位为 kbps。
305
- */
306
- setVideoKBitrate: number;
307
- /** {zh}
308
- * @deprecated
309
- * @brief 设置推流时音频的码率,单位为 bps。
191
+ * @brief 设置推流时音频的码率,单位为 kbps。
310
192
  */
311
193
  /** {en}
312
- * @deprecated
313
- * @brief Set the audio bitrate for push stream in bps.
194
+ *
195
+ * @brief Set the audio bitrate for push stream in kbps.
314
196
  */
315
197
  setAudioBitrate: number;
316
- /** {zh}
317
- * @brief 设置推流时音频的码率,单位为 kbps。
318
- */
319
- setAudioKBitrate: number;
320
198
  /** {zh}
321
199
  * @brief 设置麦克风采集的采样率,单位为 Hz。
322
200
  */
@@ -340,17 +218,6 @@ declare interface IProperty {
340
218
  *
341
219
  */
342
220
  setVolumeDetectScriptUrl: string;
343
- /** {zh}
344
- * @hidden
345
- * @brief 设置推流时默认采集的方向,默认是横屏
346
- */
347
- /** {zh}
348
- * @brief 更新推流地址,作用:断线重连时会使用最新的推流地址,避免推流过程中推流地址超时鉴权失败。
349
- */
350
- /** {en}
351
- * @brief Update the push stream address. The effect: When reconnecting, the latest push stream address will be used to avoid push stream address timeout authentication failure.
352
- */
353
- updatePushUrl: string;
354
221
  }
355
222
 
356
223
  declare type IVePusherEvents = {
@@ -434,76 +301,6 @@ declare interface IVideoStreamLayoutParams {
434
301
  * @brief When the video stream contains audio content, the corresponding audio volume ranges from `[0,100]`.
435
302
  */
436
303
  volume?: number;
437
- /** {zh}
438
- * @brief 镜像类型,默认为不镜像。
439
- */
440
- mirrorType?: MirrorType;
441
- }
442
-
443
- /** {zh}
444
- * @detail api
445
- * @brief 视频流渲染的配置信息
446
- * @id IVideoStreamRenderConfig
447
- * @name IVideoStreamRenderConfig
448
- */
449
- /** {en}
450
- * @detail api
451
- * @id IVideoStreamRenderConfig
452
- * @name IVideoStreamRenderConfig
453
- *
454
- */
455
- declare interface IVideoStreamRenderConfig {
456
- /** {zh}
457
- * @brief 配置的渲染宽度。
458
- */
459
- /** {en}
460
- * @brief The configured rendering width.
461
- */
462
- width: number;
463
- /** {zh}
464
- * @brief 配置的渲染高度。
465
- */
466
- /** {en}
467
- * @brief The configured rendering height.
468
- */
469
- height: number;
470
- /** {zh}
471
- * @brief 实际渲染宽度,(addVideoStream时使用keepRatio,实际渲染宽度可能会根据实际采集的宽高等比例缩放)。
472
- *
473
- */
474
- /** {en}
475
- * @brief The actual rendering width. (When adding a video stream, the actual rendering width may be scaled proportionally based on the actual width and height of the video stream.)
476
- */
477
- paintWidth: number;
478
- /** {zh}
479
- * @brief 实际渲染高度,(addVideoStream时使用keepRatio,实际渲染高度可能会根据实际采集的宽高等比例缩放)。
480
- *
481
- */
482
- /** {en}
483
- * @brief The actual rendering height. (When adding a video stream, the actual rendering height may be scaled proportionally based on the actual width and height of the video stream.)
484
- */
485
- paintHeight: number;
486
- /** {zh}
487
- * @brief 渲染的x坐标。
488
- */
489
- /** {en}
490
- * @brief The rendering x-coordinate.
491
- */
492
- x: number;
493
- /** {zh}
494
- * @brief 渲染的y坐标。
495
- */
496
- /** {en}
497
- * @brief The rendering y-coordinate.
498
- */
499
- y: number;
500
- /** {zh}
501
- * @brief 渲染的层级。
502
- */
503
- /** {en}
504
- * @brief The rendering layer.
505
- */
506
- zOrder: number;
507
304
  }
508
305
 
509
306
  /** {zh}
@@ -521,7 +318,6 @@ declare class LivePusher extends default_2<RTMEvents> {
521
318
  private _streamComposeController;
522
319
  private _streamConsumeController;
523
320
  private _observer;
524
- private _options;
525
321
  /** {zh}
526
322
  * @brief 查询是否支持 RTM 或 WebTransport 推流。
527
323
  * @param mode 推流模式。
@@ -926,15 +722,6 @@ declare class LivePusher extends default_2<RTMEvents> {
926
722
  * @param config Attributes of the mixing canvas, such as width, height, frame rate, etc.
927
723
  */
928
724
  setMixingConfig(config: IMixingViewConfig): void;
929
- /** {zh}
930
- * @brief 获取配置的合流参数,包括合流画布的宽度、高度、帧率等。
931
- * @return 返回配置的合流参数。
932
- */
933
- /** {en}
934
- * @brief Get the configured mixing parameters, including the width, height, and frame rate of the mixing canvas.
935
- * @return Returns the configured mixing parameters.
936
- */
937
- getMixingConfig(): IMixingViewConfig;
938
725
  /** {zh}
939
726
  * @brief 设置视频的预览区域。本地视频会在指定的容器内进行预览,同时预览内容与推流的画面和声音完全一致。
940
727
  * @param containerId 用于指定预览区域的 HTML 容器元素 ID。
@@ -1149,14 +936,6 @@ declare class LivePusher extends default_2<RTMEvents> {
1149
936
  * @return 对应流的 `MediaStream` 对象,可用于本地渲染或其他处理。
1150
937
  */
1151
938
  getMediaStream(streamId: string): MediaStream;
1152
- /** {zh}
1153
- * @hidden
1154
- * @brief 获取原始的Stream对象
1155
- */
1156
- /** {en}
1157
- * @hidden
1158
- */
1159
- getStream(streamId: string): any;
1160
939
  /** {zh}
1161
940
  * @brief 停止推流。
1162
941
  * @return 返回 `Promise` 对象。
@@ -1205,7 +984,6 @@ declare class LivePusher extends default_2<RTMEvents> {
1205
984
  * @return `video` element of the preview screen.
1206
985
  */
1207
986
  getPreviewElement(): HTMLVideoElement | null | undefined;
1208
- getVideoStreamRenderConfig(streamId: string): IVideoStreamRenderConfig | undefined;
1209
987
  private _bindEvent;
1210
988
  /** {zh}
1211
989
  * @brief 清理 SDK 实例,避免可能会产生的内存泄露。
@@ -1266,33 +1044,6 @@ declare class LivePusher extends default_2<RTMEvents> {
1266
1044
  }
1267
1045
  export default LivePusher;
1268
1046
 
1269
- /** {zh}
1270
- * @detail config
1271
- * @list config
1272
- * @brief 视频流镜像方向
1273
- * @id MirrorType
1274
- * @name MirrorType
1275
- */
1276
- declare enum MirrorType {
1277
- /** {zh}
1278
- * @brief 左右镜像
1279
- */
1280
- LeftToRight = "LeftToRight",
1281
- /** {zh}
1282
- * @brief 上下镜像
1283
- */
1284
- UpToDown = "UpToDown",
1285
- /** {zh}
1286
- * @brief 左右+上下镜像
1287
- */
1288
- All = "All",
1289
- /**
1290
- * {zh}
1291
- * @brief 不镜像
1292
- */
1293
- None = "None"
1294
- }
1295
-
1296
1047
  /** {zh}
1297
1048
  * @detail events
1298
1049
  * @list events
@@ -1412,49 +1163,6 @@ declare class Observer implements IVePusherEvents {
1412
1163
  * @notes The callback will be triggered when stopping capture actively or when capture stops passively due to an internal error.
1413
1164
  */
1414
1165
  onStopCapture: (streamId: string) => void;
1415
- /** {zh}
1416
- * @brief 推流过程中直播连接状态变化的回调。
1417
- */
1418
- /** {en}
1419
- * @brief Callback for changes in the live connection state during the streaming process.
1420
- */
1421
- onLiveConnectStateChange: (state: ConnectionState) => void;
1422
- /** {zh}
1423
- * @brief 推流过程中重连状态变化的回调。params中failedCode在失败时会返回,提示重连失败的原因。retryTime在重连等待和重连中会返回,提示当前为第几次重连。waitingTime在重连等待中会返回,提示当前等待的时间,单位为毫秒,两次重连中会等待一定时间,根据重连次数增加等待时间会增加,最大为10秒。
1424
- */
1425
- /** {en}
1426
- * @brief Callback for changes in the reconnect state during the streaming process. params will return failedCode when the connection fails, indicating the reason for the failure. retryTime will return the current retry times when the connection is in the waiting or reconnecting state, indicating the current retry times. waitingTime will return the waiting time when the connection is in the waiting state, in milliseconds, and the waiting time will increase with the number of retries, up to a maximum of 10 seconds.
1427
- */
1428
- onReconnectStateChange: (
1429
- /** {zh}
1430
- * @brief 重连状态。
1431
- */
1432
- /** {en}
1433
- * @brief Reconnect state.
1434
- */
1435
- state: ReconnectState, params?: {
1436
- /** {zh}
1437
- * @brief 重连失败时返回的失败错误码。
1438
- */
1439
- /** {en}
1440
- * @brief The error code returned when the connection fails.
1441
- */
1442
- failedCode?: ReconnectFailedCode;
1443
- /** {zh}
1444
- * @brief 重连等待中、重连中的当前重试次数。
1445
- */
1446
- /** {en}
1447
- * @brief The current retry times in the waiting or reconnecting state.
1448
- */
1449
- retryTime?: number;
1450
- /** {zh}
1451
- * @brief 重连等待中的当前等待时间,单位为毫秒。
1452
- */
1453
- /** {en}
1454
- * @brief The current waiting time in the waiting state, in milliseconds.
1455
- */
1456
- waitingTime?: number;
1457
- }) => void;
1458
1166
  /** {zh}
1459
1167
  * @brief 构造函数
1460
1168
  * @hidden
@@ -1480,72 +1188,6 @@ declare class Observer implements IVePusherEvents {
1480
1188
  */
1481
1189
  declare type PushMode = 'rtm' | 'webTransport';
1482
1190
 
1483
- /** {zh}
1484
- * @detail events
1485
- * @brief 重连重连失败码
1486
- */
1487
- declare enum ReconnectFailedCode {
1488
- /** {zh}
1489
- * @brief 推流地址失效,需要重新生成推流地址推流
1490
- */
1491
- /** {en}
1492
- * @brief The push stream address is invalid and needs to regenerate the push stream address to push
1493
- */
1494
- PushUrlInvalid = 1001,
1495
- /** {zh}
1496
- * @brief 重连超时
1497
- */
1498
- /** {en}
1499
- * @brief Reconnect timeout
1500
- */
1501
- ReconnectTimeout = 1002,
1502
- }
1503
-
1504
- /** {zh}
1505
- * @detail events
1506
- * @brief 推流重连状态码
1507
- */
1508
- /** {en}
1509
- *
1510
- */
1511
- declare enum ReconnectState {
1512
- /** {zh}
1513
- * @brief 重连开始。
1514
- */
1515
- /** {en}
1516
- * @brief Reconnect start.
1517
- */
1518
- START = 1,
1519
- /** {zh}
1520
- * @brief 重连等待。
1521
- */
1522
- /** {en}
1523
- * @brief Reconnect waiting.
1524
- */
1525
- WAITING = 2,
1526
- /** {zh}
1527
- * @brief 重连中。
1528
- */
1529
- /** {en}
1530
- * @brief Reconnecting.
1531
- */
1532
- RECONNECTING = 3,
1533
- /** {zh}
1534
- * @brief 重连成功。
1535
- */
1536
- /** {en}
1537
- * @brief Reconnect success.
1538
- */
1539
- SUCCESS = 4,
1540
- /** {zh}
1541
- * @brief 重连失败。
1542
- */
1543
- /** {en}
1544
- * @brief Reconnect failed.
1545
- */
1546
- FAILED = 5,
1547
- }
1548
-
1549
1191
  declare class RTMError extends Error {
1550
1192
  code: RTMErrorCode;
1551
1193
  message: string;
@@ -1641,8 +1283,7 @@ declare enum RTMErrorCode {
1641
1283
  *
1642
1284
  * @brief Stream connection failed. This error will be returned if the network connection fails or the server address is unreachable.
1643
1285
  */
1644
- PUSH_CONNECT_FAILED = 2003,
1645
- AUDIO_RESUME_FAILED = 2004
1286
+ PUSH_CONNECT_FAILED = 2003
1646
1287
  }
1647
1288
 
1648
1289
  declare type RTMEvents = {
@@ -1899,10 +1540,6 @@ declare type StatsSnapshoot = {
1899
1540
  * @brief Encoded frames.
1900
1541
  */
1901
1542
  framesEncoded: number;
1902
- /** {zh}
1903
- * @brief 编码的视频帧率
1904
- */
1905
- framesEncodedPerSecond: number;
1906
1543
  /** {zh}
1907
1544
  * @brief 已编码的关键帧数。
1908
1545
  */
@@ -1983,10 +1620,6 @@ declare type StatsSnapshoot = {
1983
1620
  * @brief Packet loss rate.
1984
1621
  */
1985
1622
  packetsLostPercent: number;
1986
- /** {zh}
1987
- * @brief 计算周期
1988
- */
1989
- deltaTime?: number;
1990
1623
  };
1991
1624
  audio?: {
1992
1625
  /** {zh}
@@ -2045,7 +1678,6 @@ declare type StatsSnapshoot = {
2045
1678
  * @brief Packet loss rate.
2046
1679
  */
2047
1680
  packetsLostPercent: number | undefined;
2048
- deltaAudioEnergy?: number;
2049
1681
  };
2050
1682
  };
2051
1683