@xmaxai/web-sdk 1.0.5 → 1.0.7
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/README.md +12 -242
- package/dist/{VideoContentMode-BM97_H8V.d.cts → VideoRenderStatistics-C7zqzfuS.d.cts} +23 -1
- package/dist/{VideoContentMode-BM97_H8V.d.ts → VideoRenderStatistics-C7zqzfuS.d.ts} +23 -1
- package/dist/{chunk-VMJXIVUF.js → chunk-4O5BSMUX.js} +1022 -61
- package/dist/chunk-4O5BSMUX.js.map +1 -0
- package/dist/{chunk-JN6HURTT.cjs → chunk-EKOYOFES.cjs} +1235 -274
- package/dist/{chunk-JN6HURTT.cjs.map → chunk-EKOYOFES.cjs.map} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -6
- package/dist/index.d.ts +47 -6
- package/dist/index.js +1 -1
- package/dist/react/index.cjs +6 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +5 -1
- package/dist/react/index.d.ts +5 -1
- package/dist/react/index.js +4 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +7 -9
- package/dist/chunk-VMJXIVUF.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunkEKOYOFEScjs = require('./chunk-EKOYOFES.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
@@ -69,5 +69,5 @@ var _chunkJN6HURTTcjs = require('./chunk-JN6HURTT.cjs');
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
exports.CameraPosition =
|
|
72
|
+
exports.CameraPosition = _chunkEKOYOFEScjs.CameraPosition; exports.MediaService = _chunkEKOYOFEScjs.MediaService; exports.NonRealtimeQuality = _chunkEKOYOFEScjs.NonRealtimeQuality; exports.NonRealtimeTaskError = _chunkEKOYOFEScjs.NonRealtimeTaskError; exports.NonRealtimeTaskStatus = _chunkEKOYOFEScjs.NonRealtimeTaskStatus; exports.RealtimeConfiguration = _chunkEKOYOFEScjs.RealtimeConfiguration; exports.RealtimeConnectionState = _chunkEKOYOFEScjs.RealtimeConnectionState; exports.RealtimeContext = _chunkEKOYOFEScjs.RealtimeContext; exports.RealtimeMediaStream = _chunkEKOYOFEScjs.RealtimeMediaStream; exports.RealtimeModel = _chunkEKOYOFEScjs.RealtimeModel; exports.RealtimeReason = _chunkEKOYOFEScjs.RealtimeReason; exports.RealtimeState = _chunkEKOYOFEScjs.RealtimeState; exports.RealtimeVideoEncoderPreference = _chunkEKOYOFEScjs.RealtimeVideoEncoderPreference; exports.RealtimeVideoFormat = _chunkEKOYOFEScjs.RealtimeVideoFormat; exports.RealtimeVideoSampleMethod = _chunkEKOYOFEScjs.RealtimeVideoSampleMethod; exports.RealtimeVideoTrack = _chunkEKOYOFEScjs.RealtimeVideoTrack; exports.RtcProvider = _chunkEKOYOFEScjs.RtcProvider; exports.StorageService = _chunkEKOYOFEScjs.StorageService; exports.StoredFile = _chunkEKOYOFEScjs.StoredFile; exports.VideoContentMode = _chunkEKOYOFEScjs.VideoContentMode; exports.XmaxClient = _chunkEKOYOFEScjs.XmaxClient; exports.XmaxConfiguration = _chunkEKOYOFEScjs.XmaxConfiguration; exports.XmaxEnvironment = _chunkEKOYOFEScjs.XmaxEnvironment; exports.XmaxError = _chunkEKOYOFEScjs.XmaxError; exports.XmaxErrorCode = _chunkEKOYOFEScjs.XmaxErrorCode; exports.XmaxLogger = _chunkEKOYOFEScjs.XmaxLogger; exports.XmaxLoggerOption = _chunkEKOYOFEScjs.XmaxLoggerOption; exports.XmaxRealtimeVideoView = _chunkEKOYOFEScjs.XmaxRealtimeVideoView; exports.XmaxVideoView = _chunkEKOYOFEScjs.XmaxVideoView; exports.apiBaseURL = _chunkEKOYOFEScjs.apiBaseURL; exports.defaultCameraVideoFormat = _chunkEKOYOFEScjs.defaultCameraVideoFormat; exports.defaultFrameRate = _chunkEKOYOFEScjs.defaultFrameRate; exports.modelDisplayName = _chunkEKOYOFEScjs.modelDisplayName; exports.supportedRtcProviders = _chunkEKOYOFEScjs.supportedRtcProviders;
|
|
73
73
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"sources":["/private/var/folders/5j/p3g3j18x2w3byrl5wtnk94tc0000gn/T/xmax-web-release-6u7tUB/source/packages/xmax-sdk/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,unEAAC","file":"/private/var/folders/5j/p3g3j18x2w3byrl5wtnk94tc0000gn/T/xmax-web-release-6u7tUB/source/packages/xmax-sdk/dist/index.cjs"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RealtimeVideoFormat, a as RealtimeVideoTrack, C as CameraPosition, V as VideoContentMode } from './
|
|
2
|
-
export {
|
|
1
|
+
import { R as RealtimeVideoFormat, a as RealtimeVideoTrack, C as CameraPosition, V as VideoContentMode, b as VideoRenderStatistics } from './VideoRenderStatistics-C7zqzfuS.cjs';
|
|
2
|
+
export { c as RealtimeVideoEncoderPreference, d as RealtimeVideoFormatInit } from './VideoRenderStatistics-C7zqzfuS.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 实时媒体使用的 RTC 提供方;一个 Manager 生命周期内保持不变。
|
|
@@ -25,7 +25,6 @@ declare enum RtcProvider {
|
|
|
25
25
|
declare enum RealtimeModel {
|
|
26
26
|
x2_0 = "x2.0",
|
|
27
27
|
x2_0_trtc = "x2.0-trtc",
|
|
28
|
-
x2_0_agora = "x2.0-agora",
|
|
29
28
|
x2_1_preview = "x2.1-preview"
|
|
30
29
|
}
|
|
31
30
|
/** 内置模型或服务端新增的模型标识;自定义名称原样传给服务端。 */
|
|
@@ -51,7 +50,7 @@ declare function defaultFrameRate(_model: RealtimeModelName): number;
|
|
|
51
50
|
declare function defaultCameraVideoFormat(model: RealtimeModelName): RealtimeVideoFormat;
|
|
52
51
|
/**
|
|
53
52
|
* 查询 SDK 允许配置的 RTC 提供方,第一项为默认值。
|
|
54
|
-
* 未知模型默认沿用 x2.1-preview 的
|
|
53
|
+
* 未知模型默认沿用 x2.1-preview 的 Agora,也允许显式选择其他已接入的 RTC;
|
|
55
54
|
* 是否被该模型的服务端支持,由服务端决定。
|
|
56
55
|
*/
|
|
57
56
|
declare function supportedRtcProviders(model: RealtimeModelName): readonly RtcProvider[];
|
|
@@ -202,6 +201,9 @@ declare class RealtimeConfiguration {
|
|
|
202
201
|
});
|
|
203
202
|
}
|
|
204
203
|
|
|
204
|
+
/** 输入帧顺时针旋转角度;与前置摄像头的水平镜像独立。 */
|
|
205
|
+
type CameraRotation = 0 | 90 | 180 | 270;
|
|
206
|
+
|
|
205
207
|
/**
|
|
206
208
|
* RTC 网络质量等级:未知、极好、良好、一般、差、极差、断网。
|
|
207
209
|
*/
|
|
@@ -652,6 +654,12 @@ interface XmaxRealtimeManaging {
|
|
|
652
654
|
* 切换客户端插帧,不改变回传分辨率或重启任务。不支持时抛错且保留配置。
|
|
653
655
|
*/
|
|
654
656
|
setFrameInterpolationEnabled(enabled: boolean): Promise<void>;
|
|
657
|
+
/**
|
|
658
|
+
* 手动升/降一档下行输出尺寸,便于调试 change_target_size;仅支持正在生成的 Agora 会话。
|
|
659
|
+
* 仅改变分辨率,成功发送后同步目标档位与插帧尺寸;自动调档仍保持开启。
|
|
660
|
+
* 到达 L1/L5 边界时不重复发送;发送成功不代表服务端已生效。
|
|
661
|
+
*/
|
|
662
|
+
adjustDownlinkQuality(direction: "upgrade" | "downgrade"): Promise<void>;
|
|
655
663
|
/**
|
|
656
664
|
* 当前本地媒体预览音量,取值范围为 `0...1`。
|
|
657
665
|
*/
|
|
@@ -712,6 +720,11 @@ interface XmaxRealtimeManaging {
|
|
|
712
720
|
videoFormat: RealtimeVideoFormat;
|
|
713
721
|
position: CameraPosition;
|
|
714
722
|
useMicrophone: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* 输入帧顺时针旋转角度,默认 0;videoFormat 指旋转后的目标规格。
|
|
725
|
+
* 非零角度目前仅支持 Agora,预览和上传均校正方向,镜像保持独立。
|
|
726
|
+
*/
|
|
727
|
+
rotation?: CameraRotation;
|
|
715
728
|
/**
|
|
716
729
|
* 是否在发布前等待相机预热(固定 200ms),默认 true;false 跳过等待,不产生预热耗时。
|
|
717
730
|
*/
|
|
@@ -753,11 +766,19 @@ interface XmaxRealtimeManaging {
|
|
|
753
766
|
* 成功后更新本地轨道的 videoFormat,后续重连继续使用该格式。
|
|
754
767
|
* 模型生成及远端插帧仍使用创建本地流时的格式;此接口不改变生成尺寸。
|
|
755
768
|
* 实际发送规格受设备、浏览器和网络影响,应通过统计回调确认。
|
|
769
|
+
* Agora 上行自适应以本次成功应用的完整格式作为新的 L1 基准,后续五档按比例调整尺寸和帧率。
|
|
756
770
|
*
|
|
757
771
|
* @param videoFormat 本次完整的上行尺寸、帧率和编码配置。
|
|
758
772
|
* @throws 无本地相机或文件视频流、其他操作进行中、参数无效或 RTC 更新失败时抛错。
|
|
759
773
|
*/
|
|
760
|
-
|
|
774
|
+
updateUplinkVideoFormat(videoFormat: RealtimeVideoFormat): Promise<void>;
|
|
775
|
+
/**
|
|
776
|
+
* 试验性上行调帧接口:连接建立后使用,保留最近应用的宽高、码率区间和编码偏好。
|
|
777
|
+
* 成功后更新本地轨道格式,重连沿用;不修改服务端生成或输出规格。
|
|
778
|
+
* 手动调用会重置上行质量样本,并以成功后的完整格式作为新的自适应 L1 基准。
|
|
779
|
+
* 仍会重新提交完整编码配置,不保证 RTC 内部自适应状态不受影响,需用实际统计验证。
|
|
780
|
+
*/
|
|
781
|
+
updateUplinkFrameRate(fps: number): Promise<void>;
|
|
761
782
|
/**
|
|
762
783
|
* 停止本地相机流并释放本地预览与 RTC 资源。
|
|
763
784
|
*/
|
|
@@ -1437,6 +1458,10 @@ declare class StorageService implements StorageServicing {
|
|
|
1437
1458
|
interface RemoteFrameInterpolationOptions {
|
|
1438
1459
|
size: ModelSize;
|
|
1439
1460
|
onActiveChange?: (active: boolean) => void;
|
|
1461
|
+
/**
|
|
1462
|
+
* 实际提交画布呈现时通知,参数表示是否为插值帧。
|
|
1463
|
+
*/
|
|
1464
|
+
onFramePresented?: (interpolated: boolean) => void;
|
|
1440
1465
|
onFailure: (error: unknown) => void;
|
|
1441
1466
|
}
|
|
1442
1467
|
|
|
@@ -1484,6 +1509,10 @@ declare class XmaxVideoView {
|
|
|
1484
1509
|
private interpolationOptions?;
|
|
1485
1510
|
private interpolationPipeline?;
|
|
1486
1511
|
private interpolationCanvas?;
|
|
1512
|
+
/**
|
|
1513
|
+
* 呈现统计组件
|
|
1514
|
+
*/
|
|
1515
|
+
private readonly statisticsController;
|
|
1487
1516
|
/**
|
|
1488
1517
|
* DOM 挂载状态
|
|
1489
1518
|
*/
|
|
@@ -1500,6 +1529,14 @@ declare class XmaxVideoView {
|
|
|
1500
1529
|
* 当前显示的视频轨道;切换时自动解绑旧轨道。
|
|
1501
1530
|
*/
|
|
1502
1531
|
get track(): RealtimeVideoTrack | undefined;
|
|
1532
|
+
/**
|
|
1533
|
+
* 每秒接收当前视图的呈现统计;换流、卸载或不可统计时返回 undefined。
|
|
1534
|
+
*/
|
|
1535
|
+
get renderStatisticsHandler(): ((statistics?: VideoRenderStatistics) => void) | undefined;
|
|
1536
|
+
/**
|
|
1537
|
+
* 更新统计回调,不影响播放;移除回调时停止采集。
|
|
1538
|
+
*/
|
|
1539
|
+
set renderStatisticsHandler(handler: ((statistics?: VideoRenderStatistics) => void) | undefined);
|
|
1503
1540
|
/**
|
|
1504
1541
|
* 解绑旧轨道后接入新轨道,并为新内容重新启用一次性首帧通知。
|
|
1505
1542
|
*/
|
|
@@ -1568,6 +1605,10 @@ declare class XmaxVideoView {
|
|
|
1568
1605
|
* 应用显示模式与镜像样式。
|
|
1569
1606
|
*/
|
|
1570
1607
|
private applyContentMode;
|
|
1608
|
+
/**
|
|
1609
|
+
* 视图未卸载时启动呈现统计,采样及媒体就绪检查由统计组件负责。
|
|
1610
|
+
*/
|
|
1611
|
+
private startRenderStatistics;
|
|
1571
1612
|
}
|
|
1572
1613
|
|
|
1573
1614
|
/**
|
|
@@ -1658,4 +1699,4 @@ declare class XmaxRealtimeVideoView {
|
|
|
1658
1699
|
private showRemoteVideo;
|
|
1659
1700
|
}
|
|
1660
1701
|
|
|
1661
|
-
export { CameraPosition, MediaService, type MediaServicing, type NetworkQualityLevel, type NetworkStatistics, type NetworkStatisticsListener, NonRealtimeQuality, type NonRealtimeResult, type NonRealtimeTask, NonRealtimeTaskError, type NonRealtimeTaskListOptions, type NonRealtimeTaskOptions, type NonRealtimeTaskPage, NonRealtimeTaskStatus, type NonRealtimeWaitOptions, RealtimeConfiguration, RealtimeConnectionState, RealtimeContext, type RealtimeContextInit, type RealtimeLaunchTiming, type RealtimeLaunchTimingListener, RealtimeMediaStream, RealtimeModel, type RealtimeModelName, RealtimeReason, type RealtimeReferenceVideo, RealtimeState, type RealtimeStateListener, RealtimeVideoFormat, RealtimeVideoSampleMethod, RealtimeVideoTrack, type RemoteVideoStatistics, type RemoteVideoStatisticsListener, RtcProvider, StorageService, type StorageServicing, type StorageUploadOptions, StoredFile, VideoContentMode, type VideoStatistics, type VideoStatisticsListener, XmaxClient, XmaxConfiguration, type XmaxConfigurationInit, XmaxEnvironment, XmaxError, XmaxErrorCode, type XmaxErrorListener, XmaxLogger, XmaxLoggerOption, type XmaxNonRealtimeManaging, type XmaxRealtimeManaging, XmaxRealtimeVideoView, XmaxVideoView, apiBaseURL, defaultCameraVideoFormat, defaultFrameRate, modelDisplayName, supportedRtcProviders };
|
|
1702
|
+
export { CameraPosition, type CameraRotation, MediaService, type MediaServicing, type NetworkQualityLevel, type NetworkStatistics, type NetworkStatisticsListener, NonRealtimeQuality, type NonRealtimeResult, type NonRealtimeTask, NonRealtimeTaskError, type NonRealtimeTaskListOptions, type NonRealtimeTaskOptions, type NonRealtimeTaskPage, NonRealtimeTaskStatus, type NonRealtimeWaitOptions, RealtimeConfiguration, RealtimeConnectionState, RealtimeContext, type RealtimeContextInit, type RealtimeLaunchTiming, type RealtimeLaunchTimingListener, RealtimeMediaStream, RealtimeModel, type RealtimeModelName, RealtimeReason, type RealtimeReferenceVideo, RealtimeState, type RealtimeStateListener, RealtimeVideoFormat, RealtimeVideoSampleMethod, RealtimeVideoTrack, type RemoteVideoStatistics, type RemoteVideoStatisticsListener, RtcProvider, StorageService, type StorageServicing, type StorageUploadOptions, StoredFile, VideoContentMode, VideoRenderStatistics, type VideoStatistics, type VideoStatisticsListener, XmaxClient, XmaxConfiguration, type XmaxConfigurationInit, XmaxEnvironment, XmaxError, XmaxErrorCode, type XmaxErrorListener, XmaxLogger, XmaxLoggerOption, type XmaxNonRealtimeManaging, type XmaxRealtimeManaging, XmaxRealtimeVideoView, XmaxVideoView, apiBaseURL, defaultCameraVideoFormat, defaultFrameRate, modelDisplayName, supportedRtcProviders };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RealtimeVideoFormat, a as RealtimeVideoTrack, C as CameraPosition, V as VideoContentMode } from './
|
|
2
|
-
export {
|
|
1
|
+
import { R as RealtimeVideoFormat, a as RealtimeVideoTrack, C as CameraPosition, V as VideoContentMode, b as VideoRenderStatistics } from './VideoRenderStatistics-C7zqzfuS.js';
|
|
2
|
+
export { c as RealtimeVideoEncoderPreference, d as RealtimeVideoFormatInit } from './VideoRenderStatistics-C7zqzfuS.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 实时媒体使用的 RTC 提供方;一个 Manager 生命周期内保持不变。
|
|
@@ -25,7 +25,6 @@ declare enum RtcProvider {
|
|
|
25
25
|
declare enum RealtimeModel {
|
|
26
26
|
x2_0 = "x2.0",
|
|
27
27
|
x2_0_trtc = "x2.0-trtc",
|
|
28
|
-
x2_0_agora = "x2.0-agora",
|
|
29
28
|
x2_1_preview = "x2.1-preview"
|
|
30
29
|
}
|
|
31
30
|
/** 内置模型或服务端新增的模型标识;自定义名称原样传给服务端。 */
|
|
@@ -51,7 +50,7 @@ declare function defaultFrameRate(_model: RealtimeModelName): number;
|
|
|
51
50
|
declare function defaultCameraVideoFormat(model: RealtimeModelName): RealtimeVideoFormat;
|
|
52
51
|
/**
|
|
53
52
|
* 查询 SDK 允许配置的 RTC 提供方,第一项为默认值。
|
|
54
|
-
* 未知模型默认沿用 x2.1-preview 的
|
|
53
|
+
* 未知模型默认沿用 x2.1-preview 的 Agora,也允许显式选择其他已接入的 RTC;
|
|
55
54
|
* 是否被该模型的服务端支持,由服务端决定。
|
|
56
55
|
*/
|
|
57
56
|
declare function supportedRtcProviders(model: RealtimeModelName): readonly RtcProvider[];
|
|
@@ -202,6 +201,9 @@ declare class RealtimeConfiguration {
|
|
|
202
201
|
});
|
|
203
202
|
}
|
|
204
203
|
|
|
204
|
+
/** 输入帧顺时针旋转角度;与前置摄像头的水平镜像独立。 */
|
|
205
|
+
type CameraRotation = 0 | 90 | 180 | 270;
|
|
206
|
+
|
|
205
207
|
/**
|
|
206
208
|
* RTC 网络质量等级:未知、极好、良好、一般、差、极差、断网。
|
|
207
209
|
*/
|
|
@@ -652,6 +654,12 @@ interface XmaxRealtimeManaging {
|
|
|
652
654
|
* 切换客户端插帧,不改变回传分辨率或重启任务。不支持时抛错且保留配置。
|
|
653
655
|
*/
|
|
654
656
|
setFrameInterpolationEnabled(enabled: boolean): Promise<void>;
|
|
657
|
+
/**
|
|
658
|
+
* 手动升/降一档下行输出尺寸,便于调试 change_target_size;仅支持正在生成的 Agora 会话。
|
|
659
|
+
* 仅改变分辨率,成功发送后同步目标档位与插帧尺寸;自动调档仍保持开启。
|
|
660
|
+
* 到达 L1/L5 边界时不重复发送;发送成功不代表服务端已生效。
|
|
661
|
+
*/
|
|
662
|
+
adjustDownlinkQuality(direction: "upgrade" | "downgrade"): Promise<void>;
|
|
655
663
|
/**
|
|
656
664
|
* 当前本地媒体预览音量,取值范围为 `0...1`。
|
|
657
665
|
*/
|
|
@@ -712,6 +720,11 @@ interface XmaxRealtimeManaging {
|
|
|
712
720
|
videoFormat: RealtimeVideoFormat;
|
|
713
721
|
position: CameraPosition;
|
|
714
722
|
useMicrophone: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* 输入帧顺时针旋转角度,默认 0;videoFormat 指旋转后的目标规格。
|
|
725
|
+
* 非零角度目前仅支持 Agora,预览和上传均校正方向,镜像保持独立。
|
|
726
|
+
*/
|
|
727
|
+
rotation?: CameraRotation;
|
|
715
728
|
/**
|
|
716
729
|
* 是否在发布前等待相机预热(固定 200ms),默认 true;false 跳过等待,不产生预热耗时。
|
|
717
730
|
*/
|
|
@@ -753,11 +766,19 @@ interface XmaxRealtimeManaging {
|
|
|
753
766
|
* 成功后更新本地轨道的 videoFormat,后续重连继续使用该格式。
|
|
754
767
|
* 模型生成及远端插帧仍使用创建本地流时的格式;此接口不改变生成尺寸。
|
|
755
768
|
* 实际发送规格受设备、浏览器和网络影响,应通过统计回调确认。
|
|
769
|
+
* Agora 上行自适应以本次成功应用的完整格式作为新的 L1 基准,后续五档按比例调整尺寸和帧率。
|
|
756
770
|
*
|
|
757
771
|
* @param videoFormat 本次完整的上行尺寸、帧率和编码配置。
|
|
758
772
|
* @throws 无本地相机或文件视频流、其他操作进行中、参数无效或 RTC 更新失败时抛错。
|
|
759
773
|
*/
|
|
760
|
-
|
|
774
|
+
updateUplinkVideoFormat(videoFormat: RealtimeVideoFormat): Promise<void>;
|
|
775
|
+
/**
|
|
776
|
+
* 试验性上行调帧接口:连接建立后使用,保留最近应用的宽高、码率区间和编码偏好。
|
|
777
|
+
* 成功后更新本地轨道格式,重连沿用;不修改服务端生成或输出规格。
|
|
778
|
+
* 手动调用会重置上行质量样本,并以成功后的完整格式作为新的自适应 L1 基准。
|
|
779
|
+
* 仍会重新提交完整编码配置,不保证 RTC 内部自适应状态不受影响,需用实际统计验证。
|
|
780
|
+
*/
|
|
781
|
+
updateUplinkFrameRate(fps: number): Promise<void>;
|
|
761
782
|
/**
|
|
762
783
|
* 停止本地相机流并释放本地预览与 RTC 资源。
|
|
763
784
|
*/
|
|
@@ -1437,6 +1458,10 @@ declare class StorageService implements StorageServicing {
|
|
|
1437
1458
|
interface RemoteFrameInterpolationOptions {
|
|
1438
1459
|
size: ModelSize;
|
|
1439
1460
|
onActiveChange?: (active: boolean) => void;
|
|
1461
|
+
/**
|
|
1462
|
+
* 实际提交画布呈现时通知,参数表示是否为插值帧。
|
|
1463
|
+
*/
|
|
1464
|
+
onFramePresented?: (interpolated: boolean) => void;
|
|
1440
1465
|
onFailure: (error: unknown) => void;
|
|
1441
1466
|
}
|
|
1442
1467
|
|
|
@@ -1484,6 +1509,10 @@ declare class XmaxVideoView {
|
|
|
1484
1509
|
private interpolationOptions?;
|
|
1485
1510
|
private interpolationPipeline?;
|
|
1486
1511
|
private interpolationCanvas?;
|
|
1512
|
+
/**
|
|
1513
|
+
* 呈现统计组件
|
|
1514
|
+
*/
|
|
1515
|
+
private readonly statisticsController;
|
|
1487
1516
|
/**
|
|
1488
1517
|
* DOM 挂载状态
|
|
1489
1518
|
*/
|
|
@@ -1500,6 +1529,14 @@ declare class XmaxVideoView {
|
|
|
1500
1529
|
* 当前显示的视频轨道;切换时自动解绑旧轨道。
|
|
1501
1530
|
*/
|
|
1502
1531
|
get track(): RealtimeVideoTrack | undefined;
|
|
1532
|
+
/**
|
|
1533
|
+
* 每秒接收当前视图的呈现统计;换流、卸载或不可统计时返回 undefined。
|
|
1534
|
+
*/
|
|
1535
|
+
get renderStatisticsHandler(): ((statistics?: VideoRenderStatistics) => void) | undefined;
|
|
1536
|
+
/**
|
|
1537
|
+
* 更新统计回调,不影响播放;移除回调时停止采集。
|
|
1538
|
+
*/
|
|
1539
|
+
set renderStatisticsHandler(handler: ((statistics?: VideoRenderStatistics) => void) | undefined);
|
|
1503
1540
|
/**
|
|
1504
1541
|
* 解绑旧轨道后接入新轨道,并为新内容重新启用一次性首帧通知。
|
|
1505
1542
|
*/
|
|
@@ -1568,6 +1605,10 @@ declare class XmaxVideoView {
|
|
|
1568
1605
|
* 应用显示模式与镜像样式。
|
|
1569
1606
|
*/
|
|
1570
1607
|
private applyContentMode;
|
|
1608
|
+
/**
|
|
1609
|
+
* 视图未卸载时启动呈现统计,采样及媒体就绪检查由统计组件负责。
|
|
1610
|
+
*/
|
|
1611
|
+
private startRenderStatistics;
|
|
1571
1612
|
}
|
|
1572
1613
|
|
|
1573
1614
|
/**
|
|
@@ -1658,4 +1699,4 @@ declare class XmaxRealtimeVideoView {
|
|
|
1658
1699
|
private showRemoteVideo;
|
|
1659
1700
|
}
|
|
1660
1701
|
|
|
1661
|
-
export { CameraPosition, MediaService, type MediaServicing, type NetworkQualityLevel, type NetworkStatistics, type NetworkStatisticsListener, NonRealtimeQuality, type NonRealtimeResult, type NonRealtimeTask, NonRealtimeTaskError, type NonRealtimeTaskListOptions, type NonRealtimeTaskOptions, type NonRealtimeTaskPage, NonRealtimeTaskStatus, type NonRealtimeWaitOptions, RealtimeConfiguration, RealtimeConnectionState, RealtimeContext, type RealtimeContextInit, type RealtimeLaunchTiming, type RealtimeLaunchTimingListener, RealtimeMediaStream, RealtimeModel, type RealtimeModelName, RealtimeReason, type RealtimeReferenceVideo, RealtimeState, type RealtimeStateListener, RealtimeVideoFormat, RealtimeVideoSampleMethod, RealtimeVideoTrack, type RemoteVideoStatistics, type RemoteVideoStatisticsListener, RtcProvider, StorageService, type StorageServicing, type StorageUploadOptions, StoredFile, VideoContentMode, type VideoStatistics, type VideoStatisticsListener, XmaxClient, XmaxConfiguration, type XmaxConfigurationInit, XmaxEnvironment, XmaxError, XmaxErrorCode, type XmaxErrorListener, XmaxLogger, XmaxLoggerOption, type XmaxNonRealtimeManaging, type XmaxRealtimeManaging, XmaxRealtimeVideoView, XmaxVideoView, apiBaseURL, defaultCameraVideoFormat, defaultFrameRate, modelDisplayName, supportedRtcProviders };
|
|
1702
|
+
export { CameraPosition, type CameraRotation, MediaService, type MediaServicing, type NetworkQualityLevel, type NetworkStatistics, type NetworkStatisticsListener, NonRealtimeQuality, type NonRealtimeResult, type NonRealtimeTask, NonRealtimeTaskError, type NonRealtimeTaskListOptions, type NonRealtimeTaskOptions, type NonRealtimeTaskPage, NonRealtimeTaskStatus, type NonRealtimeWaitOptions, RealtimeConfiguration, RealtimeConnectionState, RealtimeContext, type RealtimeContextInit, type RealtimeLaunchTiming, type RealtimeLaunchTimingListener, RealtimeMediaStream, RealtimeModel, type RealtimeModelName, RealtimeReason, type RealtimeReferenceVideo, RealtimeState, type RealtimeStateListener, RealtimeVideoFormat, RealtimeVideoSampleMethod, RealtimeVideoTrack, type RemoteVideoStatistics, type RemoteVideoStatisticsListener, RtcProvider, StorageService, type StorageServicing, type StorageUploadOptions, StoredFile, VideoContentMode, VideoRenderStatistics, type VideoStatistics, type VideoStatisticsListener, XmaxClient, XmaxConfiguration, type XmaxConfigurationInit, XmaxEnvironment, XmaxError, XmaxErrorCode, type XmaxErrorListener, XmaxLogger, XmaxLoggerOption, type XmaxNonRealtimeManaging, type XmaxRealtimeManaging, XmaxRealtimeVideoView, XmaxVideoView, apiBaseURL, defaultCameraVideoFormat, defaultFrameRate, modelDisplayName, supportedRtcProviders };
|
package/dist/index.js
CHANGED
package/dist/react/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkEKOYOFEScjs = require('../chunk-EKOYOFES.cjs');
|
|
5
5
|
|
|
6
6
|
// src/react/XmaxRealtimeVideo.tsx
|
|
7
7
|
|
|
@@ -17,7 +17,7 @@ function XmaxRealtimeVideo(props) {
|
|
|
17
17
|
if (!container) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const view = new (0,
|
|
20
|
+
const view = new (0, _chunkEKOYOFEScjs.XmaxRealtimeVideoView)();
|
|
21
21
|
view.element.style.width = "100%";
|
|
22
22
|
view.element.style.height = "100%";
|
|
23
23
|
view.attach(container);
|
|
@@ -71,7 +71,7 @@ function XmaxVideo(props) {
|
|
|
71
71
|
if (!container) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
const view = new (0,
|
|
74
|
+
const view = new (0, _chunkEKOYOFEScjs.XmaxVideoView)();
|
|
75
75
|
view.element.style.width = "100%";
|
|
76
76
|
view.element.style.height = "100%";
|
|
77
77
|
view.attach(container);
|
|
@@ -82,6 +82,9 @@ function XmaxVideo(props) {
|
|
|
82
82
|
view.detach();
|
|
83
83
|
};
|
|
84
84
|
}, []);
|
|
85
|
+
_react.useEffect.call(void 0, () => {
|
|
86
|
+
if (viewRef.current) viewRef.current.renderStatisticsHandler = props.onRenderStatistics;
|
|
87
|
+
}, [props.onRenderStatistics]);
|
|
85
88
|
_react.useEffect.call(void 0, () => {
|
|
86
89
|
const view = viewRef.current;
|
|
87
90
|
if (view) {
|
package/dist/react/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"sources":["/private/var/folders/5j/p3g3j18x2w3byrl5wtnk94tc0000gn/T/xmax-web-release-6u7tUB/source/packages/xmax-sdk/dist/react/index.cjs","../../src/react/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A,8BAAAA,CAAU,EAAA,GAAM;AACd,IAAA,MAAM,KAAA,EAAO,OAAA,CAAQ,OAAA;AACrB,IAAA,GAAA,CAAI,KAAA,GAAQ,KAAA,CAAM,SAAA,IAAa,KAAA,CAAA,EAAW;AACxC,MAAA,IAAA,CAAK,WAAA,EAAa,KAAA,CAAM,QAAA;AAAA,IAC1B;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,CAAM,QAAQ,CAAC,CAAA;AAEnB,EAAA,uBACEC,6BAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,YAAA;AAAA,MACL,SAAA,EAAW,KAAA,CAAM,SAAA;AAAA,MACjB,KAAA,EAAO,EAAE,QAAA,EAAU,UAAA,EAAY,QAAA,EAAU,QAAA,EAAU,GAAG,KAAA,CAAM,MAAM;AAAA,IAAA;AAAA,EACpE,CAAA;AAEJ;AFaA;AACE;AACA;AACF,6EAAC","file":"/private/var/folders/5j/p3g3j18x2w3byrl5wtnk94tc0000gn/T/xmax-web-release-6u7tUB/source/packages/xmax-sdk/dist/react/index.cjs","sourcesContent":[null,"import {\n VideoContentMode,\n XmaxRealtimeVideoView,\n type RealtimeVideoTrack,\n} from \"../index\";\nimport {\n useEffect,\n useRef,\n type CSSProperties,\n} from \"react\";\n\nexport interface XmaxRealtimeVideoProps {\n /**\n * 当前显示的本地视频轨道。\n */\n localTrack?: RealtimeVideoTrack;\n\n /**\n * 当前显示的远端生成视频轨道;首帧提交后自动渐入。\n */\n remoteTrack?: RealtimeVideoTrack;\n\n /**\n * 视频内容在容器中的显示模式,默认 fill。\n */\n videoContentMode?: VideoContentMode;\n\n /**\n * 容器类名。\n */\n className?: string;\n\n /**\n * 容器样式。\n */\n style?: CSSProperties;\n}\n\n/**\n * 本地预览和远端生成画面自动切换的 React 组件。\n */\nexport function XmaxRealtimeVideo(props: XmaxRealtimeVideoProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const viewRef = useRef<XmaxRealtimeVideoView | undefined>(undefined);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const view = new XmaxRealtimeVideoView();\n view.element.style.width = \"100%\";\n view.element.style.height = \"100%\";\n view.attach(container);\n viewRef.current = view;\n return () => {\n viewRef.current = undefined;\n view.localTrack = undefined;\n view.remoteTrack = undefined;\n view.detach();\n };\n }, []);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.localTrack = props.localTrack;\n }\n }, [props.localTrack]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.remoteTrack = props.remoteTrack;\n }\n }, [props.remoteTrack]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.videoContentMode) {\n view.videoContentMode = props.videoContentMode;\n }\n }, [props.videoContentMode]);\n\n return (\n <div\n ref={containerRef}\n className={props.className}\n style={{ position: \"relative\", overflow: \"hidden\", ...props.style }}\n />\n );\n}\n","import {\n VideoContentMode,\n XmaxVideoView,\n type RealtimeVideoTrack,\n type VideoRenderStatistics,\n} from \"../index\";\nimport {\n useEffect,\n useRef,\n type CSSProperties,\n} from \"react\";\n\nexport interface XmaxVideoProps {\n /**\n * 当前显示的视频轨道;置空时清空画面。\n */\n track?: RealtimeVideoTrack;\n\n /**\n * 视频内容在容器中的显示模式,默认 fill。\n */\n videoContentMode?: VideoContentMode;\n\n /**\n * 是否镜像显示(仅影响显示,不影响发布流)。\n */\n mirrored?: boolean;\n\n /**\n * 当前视图的呈现帧率统计;换流或卸载时清空,不受统计面板显示开关影响。\n */\n onRenderStatistics?: (statistics?: VideoRenderStatistics) => void;\n\n /**\n * 容器类名。\n */\n className?: string;\n\n /**\n * 容器样式。\n */\n style?: CSSProperties;\n}\n\n/**\n * 单轨视频 React 组件:把一路视频轨渲染到容器。\n */\nexport function XmaxVideo(props: XmaxVideoProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const viewRef = useRef<XmaxVideoView | undefined>(undefined);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const view = new XmaxVideoView();\n view.element.style.width = \"100%\";\n view.element.style.height = \"100%\";\n view.attach(container);\n viewRef.current = view;\n return () => {\n viewRef.current = undefined;\n view.track = undefined;\n view.detach();\n };\n }, []);\n\n useEffect(() => {\n if (viewRef.current) viewRef.current.renderStatisticsHandler = props.onRenderStatistics;\n }, [props.onRenderStatistics]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.track = props.track;\n }\n }, [props.track]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.videoContentMode) {\n view.videoContentMode = props.videoContentMode;\n }\n }, [props.videoContentMode]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.mirrored !== undefined) {\n view.isMirrored = props.mirrored;\n }\n }, [props.mirrored]);\n\n return (\n <div\n ref={containerRef}\n className={props.className}\n style={{ position: \"relative\", overflow: \"hidden\", ...props.style }}\n />\n );\n}\n"]}
|
package/dist/react/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
|
-
import { a as RealtimeVideoTrack, V as VideoContentMode } from '../
|
|
3
|
+
import { a as RealtimeVideoTrack, V as VideoContentMode, b as VideoRenderStatistics } from '../VideoRenderStatistics-C7zqzfuS.cjs';
|
|
4
4
|
|
|
5
5
|
interface XmaxRealtimeVideoProps {
|
|
6
6
|
/**
|
|
@@ -42,6 +42,10 @@ interface XmaxVideoProps {
|
|
|
42
42
|
* 是否镜像显示(仅影响显示,不影响发布流)。
|
|
43
43
|
*/
|
|
44
44
|
mirrored?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 当前视图的呈现帧率统计;换流或卸载时清空,不受统计面板显示开关影响。
|
|
47
|
+
*/
|
|
48
|
+
onRenderStatistics?: (statistics?: VideoRenderStatistics) => void;
|
|
45
49
|
/**
|
|
46
50
|
* 容器类名。
|
|
47
51
|
*/
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
|
-
import { a as RealtimeVideoTrack, V as VideoContentMode } from '../
|
|
3
|
+
import { a as RealtimeVideoTrack, V as VideoContentMode, b as VideoRenderStatistics } from '../VideoRenderStatistics-C7zqzfuS.js';
|
|
4
4
|
|
|
5
5
|
interface XmaxRealtimeVideoProps {
|
|
6
6
|
/**
|
|
@@ -42,6 +42,10 @@ interface XmaxVideoProps {
|
|
|
42
42
|
* 是否镜像显示(仅影响显示,不影响发布流)。
|
|
43
43
|
*/
|
|
44
44
|
mirrored?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 当前视图的呈现帧率统计;换流或卸载时清空,不受统计面板显示开关影响。
|
|
47
|
+
*/
|
|
48
|
+
onRenderStatistics?: (statistics?: VideoRenderStatistics) => void;
|
|
45
49
|
/**
|
|
46
50
|
* 容器类名。
|
|
47
51
|
*/
|
package/dist/react/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
XmaxRealtimeVideoView,
|
|
3
3
|
XmaxVideoView
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-4O5BSMUX.js";
|
|
5
5
|
|
|
6
6
|
// src/react/XmaxRealtimeVideo.tsx
|
|
7
7
|
import {
|
|
@@ -82,6 +82,9 @@ function XmaxVideo(props) {
|
|
|
82
82
|
view.detach();
|
|
83
83
|
};
|
|
84
84
|
}, []);
|
|
85
|
+
useEffect2(() => {
|
|
86
|
+
if (viewRef.current) viewRef.current.renderStatisticsHandler = props.onRenderStatistics;
|
|
87
|
+
}, [props.onRenderStatistics]);
|
|
85
88
|
useEffect2(() => {
|
|
86
89
|
const view = viewRef.current;
|
|
87
90
|
if (view) {
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react/XmaxRealtimeVideo.tsx","../../src/react/XmaxVideo.tsx"],"sourcesContent":["import {\n VideoContentMode,\n XmaxRealtimeVideoView,\n type RealtimeVideoTrack,\n} from \"../index\";\nimport {\n useEffect,\n useRef,\n type CSSProperties,\n} from \"react\";\n\nexport interface XmaxRealtimeVideoProps {\n /**\n * 当前显示的本地视频轨道。\n */\n localTrack?: RealtimeVideoTrack;\n\n /**\n * 当前显示的远端生成视频轨道;首帧提交后自动渐入。\n */\n remoteTrack?: RealtimeVideoTrack;\n\n /**\n * 视频内容在容器中的显示模式,默认 fill。\n */\n videoContentMode?: VideoContentMode;\n\n /**\n * 容器类名。\n */\n className?: string;\n\n /**\n * 容器样式。\n */\n style?: CSSProperties;\n}\n\n/**\n * 本地预览和远端生成画面自动切换的 React 组件。\n */\nexport function XmaxRealtimeVideo(props: XmaxRealtimeVideoProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const viewRef = useRef<XmaxRealtimeVideoView | undefined>(undefined);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const view = new XmaxRealtimeVideoView();\n view.element.style.width = \"100%\";\n view.element.style.height = \"100%\";\n view.attach(container);\n viewRef.current = view;\n return () => {\n viewRef.current = undefined;\n view.localTrack = undefined;\n view.remoteTrack = undefined;\n view.detach();\n };\n }, []);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.localTrack = props.localTrack;\n }\n }, [props.localTrack]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.remoteTrack = props.remoteTrack;\n }\n }, [props.remoteTrack]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.videoContentMode) {\n view.videoContentMode = props.videoContentMode;\n }\n }, [props.videoContentMode]);\n\n return (\n <div\n ref={containerRef}\n className={props.className}\n style={{ position: \"relative\", overflow: \"hidden\", ...props.style }}\n />\n );\n}\n","import {\n VideoContentMode,\n XmaxVideoView,\n type RealtimeVideoTrack,\n} from \"../index\";\nimport {\n useEffect,\n useRef,\n type CSSProperties,\n} from \"react\";\n\nexport interface XmaxVideoProps {\n /**\n * 当前显示的视频轨道;置空时清空画面。\n */\n track?: RealtimeVideoTrack;\n\n /**\n * 视频内容在容器中的显示模式,默认 fill。\n */\n videoContentMode?: VideoContentMode;\n\n /**\n * 是否镜像显示(仅影响显示,不影响发布流)。\n */\n mirrored?: boolean;\n\n /**\n * 容器类名。\n */\n className?: string;\n\n /**\n * 容器样式。\n */\n style?: CSSProperties;\n}\n\n/**\n * 单轨视频 React 组件:把一路视频轨渲染到容器。\n */\nexport function XmaxVideo(props: XmaxVideoProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const viewRef = useRef<XmaxVideoView | undefined>(undefined);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const view = new XmaxVideoView();\n view.element.style.width = \"100%\";\n view.element.style.height = \"100%\";\n view.attach(container);\n viewRef.current = view;\n return () => {\n viewRef.current = undefined;\n view.track = undefined;\n view.detach();\n };\n }, []);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.track = props.track;\n }\n }, [props.track]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.videoContentMode) {\n view.videoContentMode = props.videoContentMode;\n }\n }, [props.videoContentMode]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.mirrored !== undefined) {\n view.isMirrored = props.mirrored;\n }\n }, [props.mirrored]);\n\n return (\n <div\n ref={containerRef}\n className={props.className}\n style={{ position: \"relative\", overflow: \"hidden\", ...props.style }}\n />\n );\n}\n"],"mappings":";;;;;;AAKA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AA6EH;AA7CG,SAAS,kBAAkB,OAA+B;AAC/D,QAAM,eAAe,OAAuB,IAAI;AAChD,QAAM,UAAU,OAA0C,MAAS;AAEnE,YAAU,MAAM;AACd,UAAM,YAAY,aAAa;AAC/B,QAAI,CAAC,WAAW;AACd;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,sBAAsB;AACvC,SAAK,QAAQ,MAAM,QAAQ;AAC3B,SAAK,QAAQ,MAAM,SAAS;AAC5B,SAAK,OAAO,SAAS;AACrB,YAAQ,UAAU;AAClB,WAAO,MAAM;AACX,cAAQ,UAAU;AAClB,WAAK,aAAa;AAClB,WAAK,cAAc;AACnB,WAAK,OAAO;AAAA,IACd;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,UAAM,OAAO,QAAQ;AACrB,QAAI,MAAM;AACR,WAAK,aAAa,MAAM;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,MAAM,UAAU,CAAC;AAErB,YAAU,MAAM;AACd,UAAM,OAAO,QAAQ;AACrB,QAAI,MAAM;AACR,WAAK,cAAc,MAAM;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,MAAM,WAAW,CAAC;AAEtB,YAAU,MAAM;AACd,UAAM,OAAO,QAAQ;AACrB,QAAI,QAAQ,MAAM,kBAAkB;AAClC,WAAK,mBAAmB,MAAM;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,MAAM,gBAAgB,CAAC;AAE3B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,WAAW,MAAM;AAAA,MACjB,OAAO,EAAE,UAAU,YAAY,UAAU,UAAU,GAAG,MAAM,MAAM;AAAA;AAAA,EACpE;AAEJ;;;
|
|
1
|
+
{"version":3,"sources":["../../src/react/XmaxRealtimeVideo.tsx","../../src/react/XmaxVideo.tsx"],"sourcesContent":["import {\n VideoContentMode,\n XmaxRealtimeVideoView,\n type RealtimeVideoTrack,\n} from \"../index\";\nimport {\n useEffect,\n useRef,\n type CSSProperties,\n} from \"react\";\n\nexport interface XmaxRealtimeVideoProps {\n /**\n * 当前显示的本地视频轨道。\n */\n localTrack?: RealtimeVideoTrack;\n\n /**\n * 当前显示的远端生成视频轨道;首帧提交后自动渐入。\n */\n remoteTrack?: RealtimeVideoTrack;\n\n /**\n * 视频内容在容器中的显示模式,默认 fill。\n */\n videoContentMode?: VideoContentMode;\n\n /**\n * 容器类名。\n */\n className?: string;\n\n /**\n * 容器样式。\n */\n style?: CSSProperties;\n}\n\n/**\n * 本地预览和远端生成画面自动切换的 React 组件。\n */\nexport function XmaxRealtimeVideo(props: XmaxRealtimeVideoProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const viewRef = useRef<XmaxRealtimeVideoView | undefined>(undefined);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const view = new XmaxRealtimeVideoView();\n view.element.style.width = \"100%\";\n view.element.style.height = \"100%\";\n view.attach(container);\n viewRef.current = view;\n return () => {\n viewRef.current = undefined;\n view.localTrack = undefined;\n view.remoteTrack = undefined;\n view.detach();\n };\n }, []);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.localTrack = props.localTrack;\n }\n }, [props.localTrack]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.remoteTrack = props.remoteTrack;\n }\n }, [props.remoteTrack]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.videoContentMode) {\n view.videoContentMode = props.videoContentMode;\n }\n }, [props.videoContentMode]);\n\n return (\n <div\n ref={containerRef}\n className={props.className}\n style={{ position: \"relative\", overflow: \"hidden\", ...props.style }}\n />\n );\n}\n","import {\n VideoContentMode,\n XmaxVideoView,\n type RealtimeVideoTrack,\n type VideoRenderStatistics,\n} from \"../index\";\nimport {\n useEffect,\n useRef,\n type CSSProperties,\n} from \"react\";\n\nexport interface XmaxVideoProps {\n /**\n * 当前显示的视频轨道;置空时清空画面。\n */\n track?: RealtimeVideoTrack;\n\n /**\n * 视频内容在容器中的显示模式,默认 fill。\n */\n videoContentMode?: VideoContentMode;\n\n /**\n * 是否镜像显示(仅影响显示,不影响发布流)。\n */\n mirrored?: boolean;\n\n /**\n * 当前视图的呈现帧率统计;换流或卸载时清空,不受统计面板显示开关影响。\n */\n onRenderStatistics?: (statistics?: VideoRenderStatistics) => void;\n\n /**\n * 容器类名。\n */\n className?: string;\n\n /**\n * 容器样式。\n */\n style?: CSSProperties;\n}\n\n/**\n * 单轨视频 React 组件:把一路视频轨渲染到容器。\n */\nexport function XmaxVideo(props: XmaxVideoProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const viewRef = useRef<XmaxVideoView | undefined>(undefined);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const view = new XmaxVideoView();\n view.element.style.width = \"100%\";\n view.element.style.height = \"100%\";\n view.attach(container);\n viewRef.current = view;\n return () => {\n viewRef.current = undefined;\n view.track = undefined;\n view.detach();\n };\n }, []);\n\n useEffect(() => {\n if (viewRef.current) viewRef.current.renderStatisticsHandler = props.onRenderStatistics;\n }, [props.onRenderStatistics]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view) {\n view.track = props.track;\n }\n }, [props.track]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.videoContentMode) {\n view.videoContentMode = props.videoContentMode;\n }\n }, [props.videoContentMode]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (view && props.mirrored !== undefined) {\n view.isMirrored = props.mirrored;\n }\n }, [props.mirrored]);\n\n return (\n <div\n ref={containerRef}\n className={props.className}\n style={{ position: \"relative\", overflow: \"hidden\", ...props.style }}\n />\n );\n}\n"],"mappings":";;;;;;AAKA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AA6EH;AA7CG,SAAS,kBAAkB,OAA+B;AAC/D,QAAM,eAAe,OAAuB,IAAI;AAChD,QAAM,UAAU,OAA0C,MAAS;AAEnE,YAAU,MAAM;AACd,UAAM,YAAY,aAAa;AAC/B,QAAI,CAAC,WAAW;AACd;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,sBAAsB;AACvC,SAAK,QAAQ,MAAM,QAAQ;AAC3B,SAAK,QAAQ,MAAM,SAAS;AAC5B,SAAK,OAAO,SAAS;AACrB,YAAQ,UAAU;AAClB,WAAO,MAAM;AACX,cAAQ,UAAU;AAClB,WAAK,aAAa;AAClB,WAAK,cAAc;AACnB,WAAK,OAAO;AAAA,IACd;AAAA,EACF,GAAG,CAA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B,CAAC;AAE7B,EAAAA,WAAU,MAAM;AACd,UAAM,OAAO,QAAQ;AACrB,QAAI,MAAM;AACR,WAAK,QAAQ,MAAM;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,MAAM,KAAK,CAAC;AAEhB,EAAAA,WAAU,MAAM;AACd,UAAM,OAAO,QAAQ;AACrB,QAAI,QAAQ,MAAM,kBAAkB;AAClC,WAAK,mBAAmB,MAAM;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,MAAM,gBAAgB,CAAC;AAE3B,EAAAA,WAAU,MAAM;AACd,UAAM,OAAO,QAAQ;AACrB,QAAI,QAAQ,MAAM,aAAa,QAAW;AACxC,WAAK,aAAa,MAAM;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,MAAM,QAAQ,CAAC;AAEnB,SACE,gBAAAE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,WAAW,MAAM;AAAA,MACjB,OAAO,EAAE,UAAU,YAAY,UAAU,UAAU,GAAG,MAAM,MAAM;AAAA;AAAA,EACpE;AAEJ;","names":["useEffect","useRef","jsx"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmaxai/web-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "XmaxSDK for Web — Realtime Interactive Video Generation",
|
|
6
6
|
"type": "module",
|
|
@@ -23,13 +23,6 @@
|
|
|
23
23
|
"dist",
|
|
24
24
|
"LICENSE"
|
|
25
25
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "node scripts/embed-framegen.mjs && tsup",
|
|
28
|
-
"test": "vitest run",
|
|
29
|
-
"typecheck": "tsc --noEmit",
|
|
30
|
-
"prepack": "cp ../../README.md ./README.md",
|
|
31
|
-
"prepublishOnly": "npm run build && npm run test && cp ../../README.md ./README.md"
|
|
32
|
-
},
|
|
33
26
|
"devDependencies": {
|
|
34
27
|
"@types/react": "^18.3.12",
|
|
35
28
|
"react": "^18.3.1",
|
|
@@ -52,5 +45,10 @@
|
|
|
52
45
|
"framegen": "1.4.0",
|
|
53
46
|
"cos-js-sdk-v5": "^1.10.1",
|
|
54
47
|
"trtc-sdk-v5": "^5.6.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "node scripts/embed-framegen.mjs && tsup",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"typecheck": "tsc --noEmit"
|
|
55
53
|
}
|
|
56
|
-
}
|
|
54
|
+
}
|