@xmaxai/sdk 1.0.2 → 1.0.3
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/CHANGELOG.md +2 -1
- package/README.md +10 -0
- package/dist/{chunk-TFGYBN3Q.js → chunk-B5EAQTBY.js} +6 -2
- package/dist/chunk-B5EAQTBY.js.map +1 -0
- package/dist/{chunk-F567ONBH.js → chunk-ZMLV7YQP.js} +20 -3
- package/dist/{chunk-F567ONBH.js.map → chunk-ZMLV7YQP.js.map} +1 -1
- package/dist/index.cjs +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +21 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +2 -2
- package/dist/{rtc-manager-DnQoznIg.d.cts → rtc-manager-Bk2lIJ0d.d.cts} +5 -0
- package/dist/{rtc-manager-DnQoznIg.d.ts → rtc-manager-Bk2lIJ0d.d.ts} +5 -0
- package/dist/video-file-stream-OVPBV7IX.js +3 -0
- package/dist/{video-file-stream-4TAGKL2Q.js.map → video-file-stream-OVPBV7IX.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-TFGYBN3Q.js.map +0 -1
- package/dist/video-file-stream-4TAGKL2Q.js +0 -3
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,8 @@ var init_en_US = __esm({
|
|
|
36
36
|
"errors.sessionJoinInfoIncomplete": "session does not contain complete RTC join info",
|
|
37
37
|
"errors.sessionUidMissing": "session does not contain sessionUid",
|
|
38
38
|
"errors.refImageMissing": "missing reference image",
|
|
39
|
+
"errors.imageCheckMissingUrl": "image check response missing url",
|
|
40
|
+
"errors.imageCheckUnsafe": "image did not pass safety check",
|
|
39
41
|
"errors.captureStreamUnsupported": "captureStream is not supported in this browser",
|
|
40
42
|
"errors.videoTrackMissing": "failed to create video track from file",
|
|
41
43
|
"errors.imageTrackMissing": "failed to create video track from image file",
|
|
@@ -97,6 +99,8 @@ var init_zh_CN = __esm({
|
|
|
97
99
|
"errors.sessionJoinInfoIncomplete": "session \u7F3A\u5C11\u5B8C\u6574\u7684 RTC \u8FDB\u623F\u4FE1\u606F",
|
|
98
100
|
"errors.sessionUidMissing": "session \u7F3A\u5C11 sessionUid",
|
|
99
101
|
"errors.refImageMissing": "\u7F3A\u5C11\u53C2\u8003\u56FE",
|
|
102
|
+
"errors.imageCheckMissingUrl": "\u56FE\u7247\u68C0\u67E5\u54CD\u5E94\u7F3A\u5C11 url",
|
|
103
|
+
"errors.imageCheckUnsafe": "\u56FE\u7247\u672A\u901A\u8FC7\u5B89\u5168\u68C0\u67E5",
|
|
100
104
|
"errors.captureStreamUnsupported": "\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 captureStream",
|
|
101
105
|
"errors.videoTrackMissing": "\u672A\u80FD\u4ECE\u89C6\u9891\u6587\u4EF6\u521B\u5EFA video track",
|
|
102
106
|
"errors.imageTrackMissing": "\u672A\u80FD\u4ECE\u56FE\u7247\u6587\u4EF6\u521B\u5EFA video track",
|
|
@@ -1177,6 +1181,23 @@ var XmaxOpenClient = class {
|
|
|
1177
1181
|
async uploadVideo(file) {
|
|
1178
1182
|
return this.uploadObject(file, "video/");
|
|
1179
1183
|
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Upload an image then run Playground-style `/cos/image/check`.
|
|
1186
|
+
* Returns the checked URL. Existing {@link uploadImage} is unchanged.
|
|
1187
|
+
*/
|
|
1188
|
+
async uploadAndCheckImage(file) {
|
|
1189
|
+
const uploaded = await this.uploadImage(file);
|
|
1190
|
+
const data = await this.request("POST", "/cos/image/check", {
|
|
1191
|
+
url: uploaded.url
|
|
1192
|
+
});
|
|
1193
|
+
if (!data?.url) {
|
|
1194
|
+
this.throwError(this.i18n.t("errors.imageCheckMissingUrl"));
|
|
1195
|
+
}
|
|
1196
|
+
if (data.safe === false) {
|
|
1197
|
+
this.throwError(this.i18n.t("errors.imageCheckUnsafe"));
|
|
1198
|
+
}
|
|
1199
|
+
return data.url;
|
|
1200
|
+
}
|
|
1180
1201
|
startHeartbeat(sessionUid, intervalMs = 1e4, onHeartbeat, onError) {
|
|
1181
1202
|
this.stopHeartbeat();
|
|
1182
1203
|
const heartbeat = async () => {
|
|
@@ -4539,7 +4560,8 @@ function createXmaxClient(options) {
|
|
|
4539
4560
|
files: {
|
|
4540
4561
|
uploadImage: (file) => httpClient.uploadImage(file),
|
|
4541
4562
|
uploadVideo: (file) => httpClient.uploadVideo(file),
|
|
4542
|
-
upload: (file) => httpClient.uploadImage(file)
|
|
4563
|
+
upload: (file) => httpClient.uploadImage(file),
|
|
4564
|
+
uploadAndCheckImage: (file) => httpClient.uploadAndCheckImage(file)
|
|
4543
4565
|
},
|
|
4544
4566
|
realtime: {
|
|
4545
4567
|
prewarm: (options2) => RealtimePrewarmHandle.create(options2.model, resolved),
|