@xmaxai/web-sdk 1.0.4 → 1.0.6
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 +248 -21
- 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-FEL5MJMJ.cjs → chunk-NWNRFTLE.cjs} +2627 -505
- package/dist/chunk-NWNRFTLE.cjs.map +1 -0
- package/dist/{chunk-FMAQXPTE.js → chunk-PLFWPS5A.js} +2439 -317
- package/dist/chunk-PLFWPS5A.js.map +1 -0
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +387 -96
- package/dist/index.d.ts +387 -96
- package/dist/index.js +15 -3
- 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 +1 -1
- package/dist/chunk-FEL5MJMJ.cjs.map +0 -1
- package/dist/chunk-FMAQXPTE.js.map +0 -1
package/README.md
CHANGED
|
@@ -214,10 +214,8 @@ The following JavaScript snippet creates a camera stream, starts real-time gener
|
|
|
214
214
|
and binds the output to a video view. Run this within an async function in the browser,
|
|
215
215
|
after a user action such as clicking a Start button.
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
`RealtimeModel.x2_0_trtc` (`x2.0-trtc`).
|
|
219
|
-
`RealtimeModel.x2_0_agora` (`x2.0-agora`) with `RtcProvider.agora`. For VeRTC, use
|
|
220
|
-
`RealtimeModel.x2_1_preview` (`x2.1-preview`) with `RtcProvider.vertc`.
|
|
217
|
+
For Agora, use `RealtimeModel.x2_1_preview` (`x2.1-preview`). For TRTC, use
|
|
218
|
+
`RealtimeModel.x2_0_trtc` (`x2.0-trtc`). `RealtimeModel.x2_0` (`x2.0`) uses VeRTC.
|
|
221
219
|
|
|
222
220
|
```javascript
|
|
223
221
|
import {
|
|
@@ -272,11 +270,11 @@ videoView.remoteTrack = remoteStream.videoTrack;
|
|
|
272
270
|
Add a `video-container` element with an explicit width and height to your page.
|
|
273
271
|
The view displays a local camera preview until the first generated frame arrives.
|
|
274
272
|
|
|
275
|
-
Use `
|
|
273
|
+
Use `updateUplinkVideoFormat` after creating the local camera stream, including during
|
|
276
274
|
generation, to change upstream encoding without reconnecting or restarting the task:
|
|
277
275
|
|
|
278
276
|
```javascript
|
|
279
|
-
await realtime.
|
|
277
|
+
await realtime.updateUplinkVideoFormat(new RealtimeVideoFormat({
|
|
280
278
|
width: 1024,
|
|
281
279
|
height: 1920,
|
|
282
280
|
fps: 20,
|
|
@@ -292,39 +290,110 @@ resolution, frame rate, and bitrate depend on the device, browser, and network;
|
|
|
292
290
|
use the statistics callbacks to observe them. Await each operation before starting
|
|
293
291
|
another configuration or lifecycle operation.
|
|
294
292
|
|
|
295
|
-
|
|
296
|
-
above; camera capture, generation, rendering, and cleanup use the same APIs:
|
|
293
|
+
For a frame-rate-only experiment after connecting a local camera or file stream:
|
|
297
294
|
|
|
298
295
|
```javascript
|
|
299
|
-
|
|
296
|
+
await realtime.updateUplinkFrameRate(24);
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
This preserves the last successfully applied width, height, resolved bitrate limits,
|
|
300
|
+
and encoding preference. It does not recalculate default bitrates for the new frame
|
|
301
|
+
rate or copy measured send statistics into the configuration. The complete encoder
|
|
302
|
+
configuration is still resubmitted, so preservation of RTC's internal adaptation
|
|
303
|
+
state is not guaranteed. Validate actual send statistics under weak networks.
|
|
304
|
+
|
|
305
|
+
**Agora camera sender-only experiment:** camera capture stays at its initial settings.
|
|
306
|
+
Camera updates use `RTCRtpSender.setParameters()` (`scaleResolutionDownBy`,
|
|
307
|
+
`maxFramerate`, `maxBitrate` in bps), not Agora's `setEncoderConfiguration()`.
|
|
308
|
+
Only the maximum bitrate is applied; the standard sender API cannot enforce the
|
|
309
|
+
configured minimum bitrate. Pre-publish updates are queued and applied immediately
|
|
310
|
+
after publication, so the very first transmitted frames may use the initial profile.
|
|
311
|
+
Scaling uses the actual captured dimensions, preserves aspect ratio, and does not upscale.
|
|
312
|
+
Sender replacement/rejoin reapplies the latest target. Unsupported or silently ignored
|
|
313
|
+
parameters are reported as errors, without falling back to camera constraints.
|
|
314
|
+
Read-back confirms accepted parameters, not actual frame dimensions or persistent
|
|
315
|
+
ownership against Agora's later adjustments; validate Chrome/Safari using RTC statistics.
|
|
316
|
+
Search `Agora Sender Parameters` for accepted limits and `Agora RTC Statistics` for
|
|
317
|
+
capture/send dimensions. File-video encoding and other RTC providers are unchanged.
|
|
318
|
+
|
|
319
|
+
Agora uplink and downlink adaptation are always enabled; no configuration flag or manual
|
|
320
|
+
selector is needed. Other RTC providers are not yet integrated. After generation
|
|
321
|
+
starts, three consecutive poor uplink quality samples lower one tier, and five good
|
|
322
|
+
samples probe an upgrade. Five tiers jointly change resolution and frame rate:
|
|
323
|
+
1024×1920/30, 768×1440/24, 640×1200/24, 512×960/20, and 384×720/16.
|
|
324
|
+
Landscape dimensions are swapped; custom sources scale proportionally from their
|
|
325
|
+
initial or most recently manually applied format, with even dimensions and FPS
|
|
326
|
+
capped by that baseline. Automatic updates preserve this baseline across reconnects.
|
|
327
|
+
Default bitrate limits are recalculated for each tier; explicit limits and encoding
|
|
328
|
+
preference are preserved. Uplink changes do not alter generation or result-stream sizes.
|
|
329
|
+
Downlink independently uses the same quality thresholds and five resolution tiers,
|
|
330
|
+
relative to the generation's original dimensions. It sends only `change_target_size`
|
|
331
|
+
with `[width, height]`, without changing FPS, bitrate limits, or model inference.
|
|
332
|
+
The protocol has no application ACK: a successful send records a requested tier,
|
|
333
|
+
not a confirmed output size; use remote RTC statistics to verify actual dimensions.
|
|
334
|
+
New Agora local tracks read the last applied uplink tier before publishing
|
|
335
|
+
(the camera sender-only experiment applies it immediately after publication);
|
|
336
|
+
new generation tasks restore the last requested downlink tier via `start.params.target_size`.
|
|
337
|
+
Each direction falls back to L2 when no valid history is available. History is stored
|
|
338
|
+
in `localStorage`, separately by model and direction, with no expiry or stability window
|
|
339
|
+
in this first version. Storage failures never block generation. The original L1 baseline
|
|
340
|
+
is retained for recovery; reconnecting the same local track keeps its in-memory uplink tier.
|
|
341
|
+
Downlink changes only resolution, not FPS. Interpolation follows the requested dimensions,
|
|
342
|
+
showing raw video while frame sizes do not match. See
|
|
343
|
+
[the strategy and weak-network test steps](docs/realtime-adaptive-quality.md).
|
|
344
|
+
|
|
345
|
+
Each model declares its supported RTC providers. The SDK selects the model's
|
|
346
|
+
default provider when `provider` is omitted. To use Agora, replace the manager
|
|
347
|
+
configuration above; camera capture, generation, rendering, and cleanup use the same APIs:
|
|
300
348
|
|
|
349
|
+
```javascript
|
|
301
350
|
const realtime = client.createRealtimeManager(
|
|
302
351
|
new RealtimeConfiguration({
|
|
303
|
-
|
|
304
|
-
model: RealtimeModel.x2_0_agora,
|
|
352
|
+
model: RealtimeModel.x2_1_preview,
|
|
305
353
|
})
|
|
306
354
|
);
|
|
307
355
|
```
|
|
308
356
|
|
|
309
|
-
To use VeRTC,
|
|
357
|
+
To use VeRTC, select `x2.0`:
|
|
310
358
|
|
|
311
359
|
```javascript
|
|
312
360
|
const realtime = client.createRealtimeManager(
|
|
313
361
|
new RealtimeConfiguration({
|
|
314
|
-
|
|
315
|
-
model: RealtimeModel.x2_1_preview,
|
|
362
|
+
model: RealtimeModel.x2_0,
|
|
316
363
|
})
|
|
317
364
|
);
|
|
318
365
|
```
|
|
319
366
|
|
|
320
|
-
The provider is fixed for each manager
|
|
321
|
-
`
|
|
322
|
-
`
|
|
323
|
-
|
|
367
|
+
The provider is fixed for each manager: `x2.0-trtc` uses `RtcProvider.trtc`,
|
|
368
|
+
`x2.1-preview` uses `RtcProvider.agora`, and `x2.0` uses `RtcProvider.vertc`.
|
|
369
|
+
Import `RtcProvider` to specify it explicitly; unsupported known-model/provider
|
|
370
|
+
combinations are rejected during configuration. Use the exported
|
|
371
|
+
`supportedRtcProviders(model)` to inspect model capabilities. The SDK does not read
|
|
372
|
+
`modelExtra.provider` from the backend; the resolved configuration determines how
|
|
373
|
+
RTC credentials are parsed.
|
|
374
|
+
|
|
375
|
+
The `x2.1-preview` model uses `https://cloud.xmax.22duck.cn/open/api/v1` in both environments.
|
|
376
|
+
The other built-in models and file uploads use the configured
|
|
377
|
+
environment's production API endpoint: `https://cloud.xmax.22duck.cn/open/api/v1`
|
|
378
|
+
for China and `https://api.xmax.cloud/open/api/v1` for Global.
|
|
324
379
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
380
|
+
Custom realtime model names are also accepted without an SDK update:
|
|
381
|
+
|
|
382
|
+
```javascript
|
|
383
|
+
const realtime = client.createRealtimeManager(
|
|
384
|
+
new RealtimeConfiguration({ model: "your-new-model" })
|
|
385
|
+
);
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
The model name is sent unchanged; the server determines whether it is available.
|
|
389
|
+
Unknown models inherit the `x2.1-preview` defaults: Agora, the production session API above
|
|
390
|
+
(in both client environments), a 1024 × 1920 camera at 30 fps, and the same
|
|
391
|
+
1024 × 1920 / 1920 × 1024 input resolution buckets and media rules.
|
|
392
|
+
You may explicitly choose another supported `RtcProvider` for a custom model;
|
|
393
|
+
`supportedRtcProviders` lists all SDK adapters for custom models, with Agora first,
|
|
394
|
+
but this does not guarantee server-side support. `modelDisplayName` returns the
|
|
395
|
+
custom name unchanged. Empty/blank or non-string model names, invalid RTC providers,
|
|
396
|
+
and invalid video parameters are still rejected locally.
|
|
328
397
|
|
|
329
398
|
VeRTC uses `@volcengine/rtc` 4.69.3 and the fixed AppID
|
|
330
399
|
`69a177e226e9b90176a86b96`. Session credentials must contain this `rtc_app_id`,
|
|
@@ -403,6 +472,14 @@ For camera input, bind the returned video track to a preview view. The SDK enter
|
|
|
403
472
|
`ready` after it has received a valid frame and the preview view is bound; observe
|
|
404
473
|
this through `setStateListener`.
|
|
405
474
|
|
|
475
|
+
At generation start, the SDK sends `params.mirror: true` for the front camera
|
|
476
|
+
and `false` for the rear camera, local files, and network videos. The backend
|
|
477
|
+
mirrors the input; generated results are not automatically mirrored in the
|
|
478
|
+
browser. The front-camera local preview remains mirrored independently.
|
|
479
|
+
This flag is sent only with `start`: switching cameras during an active generation
|
|
480
|
+
does not update it. Disconnect and start generation again to apply the new camera
|
|
481
|
+
position to the backend.
|
|
482
|
+
|
|
406
483
|
<br>
|
|
407
484
|
|
|
408
485
|
### Resource Cleanup
|
|
@@ -437,6 +514,156 @@ this through `setStateListener`.
|
|
|
437
514
|
|
|
438
515
|
<br>
|
|
439
516
|
|
|
517
|
+
### Generate from a local video
|
|
518
|
+
|
|
519
|
+
Use a manager configured for TRTC, Agora or VeRTC. The SDK decodes a local `File` or `Blob`, sends its video through Canvas and its audio through Web Audio, and receives the generated result over RTC. It does not upload the file to storage or request camera/microphone access.
|
|
520
|
+
|
|
521
|
+
```ts
|
|
522
|
+
// Call directly from a file-selection or click handler to unlock browser playback.
|
|
523
|
+
const localStream = await realtime.createLocalVideoStream({
|
|
524
|
+
file,
|
|
525
|
+
videoFormat: new RealtimeVideoFormat({ width: 1920, height: 1024, fps: 30 }),
|
|
526
|
+
loop: true,
|
|
527
|
+
includeAudio: true,
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
// Optionally bind localStream.videoTrack to an SDK video view.
|
|
531
|
+
const remoteStream = await realtime.startGeneration({
|
|
532
|
+
localStream,
|
|
533
|
+
context: new RealtimeContext({ prompt: "Transform the scene into an animation" }),
|
|
534
|
+
});
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
Preparation stops at the first frame. After the connection is established and the start signal is sent, the file plays from the beginning; playback does not wait for a remote frame. `loop` defaults to `true`, looping both file video and audio; set it to `false` to play once. The current protocol does not acknowledge server input readiness, so frame-perfect processing of the very beginning is not guaranteed.
|
|
538
|
+
|
|
539
|
+
For local files, requested dimensions automatically select the model resolution with the closest aspect ratio, preferring landscape on ties; exact matches are preserved. For example, `1280×720` selects `1920×1024`. Models without fixed resolutions retain their existing pixel-budget sizing rules. The file is scaled proportionally into the resulting Canvas, with black bars where needed, and the returned track's `videoFormat` reflects that target size. This does not change camera or network-video size validation. Local preview is always silent; `localAudioVolume` does not alter the file's uplink audio. File audio is enabled by default; a file without an audio track produces silence. Set `includeAudio: false` to omit the audio track entirely. Use `setRemoteAudioVolume` to hear the generated result (muted by default).
|
|
540
|
+
|
|
541
|
+
`disconnect()` pauses playback and retains the source. A new generation after reconnecting starts from the beginning; updating conditions during generation does not restart playback. With looping disabled, file completion holds the final frame and leaves the RTC connection open so remote tail frames can play. `close()` releases all file resources and tracks. `updateUplinkVideoFormat()` can adjust uplink encoding without changing the original model input format.
|
|
542
|
+
|
|
543
|
+
File codecs must be supported by the browser, and Canvas capture and Web Audio must be available. Keep the page foregrounded for stable frame delivery; browser background throttling can reduce the upload frame rate. Playback restrictions, decode errors and preparation timeouts are reported rather than silently sending an empty stream.
|
|
544
|
+
|
|
545
|
+
### Generate from a network video
|
|
546
|
+
|
|
547
|
+
Pass an HTTP or HTTPS video URL to let the server read the source directly. The SDK joins the RTC room and receives generated video and audio without capturing or publishing local media.
|
|
548
|
+
|
|
549
|
+
```ts
|
|
550
|
+
import { RealtimeContext, RealtimeVideoFormat, RealtimeVideoSampleMethod } from "@xmaxai/web-sdk";
|
|
551
|
+
|
|
552
|
+
const localStream = await realtime.createNetworkVideoStream({
|
|
553
|
+
url: "https://example.com/source.mp4",
|
|
554
|
+
videoFormat: new RealtimeVideoFormat({ width: 1920, height: 1024, fps: 30 }),
|
|
555
|
+
sampleMethod: RealtimeVideoSampleMethod.time,
|
|
556
|
+
onFinish: () => {
|
|
557
|
+
console.log("Server finished processing the video");
|
|
558
|
+
},
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
const remoteStream = await realtime.startGeneration({
|
|
562
|
+
localStream,
|
|
563
|
+
context: new RealtimeContext({ prompt: "Transform the scene into an animation" }),
|
|
564
|
+
});
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
Use a video format supported by the selected model. Bind the returned tracks to SDK video views as usual. The optional local preview plays once, muted, independently of server processing; no Canvas or local upload is involved. Creating the source does not start generation. Sampling defaults to `time`; `fps` is also available.
|
|
568
|
+
|
|
569
|
+
The URL must be directly accessible to the server. Browser cookies and custom authorization headers are not forwarded. Local preview playback depends on browser codec support and page security policies; a preview failure does not stop server processing. The selected model's backend must support network video input.
|
|
570
|
+
|
|
571
|
+
`onFinish` is delivered once for the current task after the server's `video_stopped` message and generation readiness. It does not mean the last remote frame has finished playing, so the SDK does not automatically disconnect. Local preview completion does not trigger this callback. Remote audio follows `setRemoteAudioVolume` (muted by default).
|
|
572
|
+
|
|
573
|
+
`disconnect()` retains the source and preview for reconnection; `close()` releases them. Close the current source before creating another. `updateUplinkVideoFormat()` adjusts camera uplink encoding and is not available for a network video source.
|
|
574
|
+
|
|
575
|
+
### Non-realtime video tasks
|
|
576
|
+
|
|
577
|
+
Use `client.createNonRealtimeManager()` to submit video-file processing tasks.
|
|
578
|
+
This is cloud processing, not on-device or offline execution. It uses the client's
|
|
579
|
+
API key and selects a dedicated task endpoint from `XmaxEnvironment`:
|
|
580
|
+
|
|
581
|
+
- `china`: `https://api.xmaxai.com/open/api/v1`
|
|
582
|
+
- `global`: `https://api.xmax.ai/open/api/v1`
|
|
583
|
+
|
|
584
|
+
Task requests append `/offline-task` and its subpaths to this base URL.
|
|
585
|
+
Realtime model endpoint overrides do not affect task requests; storage credentials
|
|
586
|
+
continue to use the environment's default API endpoint.
|
|
587
|
+
|
|
588
|
+
```typescript
|
|
589
|
+
import { NonRealtimeQuality, NonRealtimeTaskError } from "@xmaxai/web-sdk";
|
|
590
|
+
|
|
591
|
+
const manager = client.createNonRealtimeManager();
|
|
592
|
+
const controller = new AbortController();
|
|
593
|
+
|
|
594
|
+
// videoFile is a File selected by the user.
|
|
595
|
+
const storedVideo = await client.createStorageService().uploadVideo({
|
|
596
|
+
data: videoFile,
|
|
597
|
+
fileName: videoFile.name,
|
|
598
|
+
onProgress: (loaded, total) => console.log(loaded, total),
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
const task = await manager.submitTask({
|
|
602
|
+
videoPath: storedVideo.url,
|
|
603
|
+
referencePath: referenceImageURL, // Optional; obtain via uploadImage().
|
|
604
|
+
prompt: "Change the character's clothing while preserving the motion.",
|
|
605
|
+
quality: NonRealtimeQuality.hd,
|
|
606
|
+
// Omit fps to retain the source frame rate, including fractional rates.
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
// Persist task.uid before waiting, so the task can be queried after a reload.
|
|
610
|
+
try {
|
|
611
|
+
const completed = await manager.waitForCompletion(task.uid, {
|
|
612
|
+
intervalMs: 2000,
|
|
613
|
+
timeoutMs: 30 * 60 * 1000, // Optional client-side deadline.
|
|
614
|
+
signal: controller.signal,
|
|
615
|
+
onTaskUpdated: (snapshot) => console.log(snapshot.status),
|
|
616
|
+
});
|
|
617
|
+
console.log(completed.result?.url);
|
|
618
|
+
} catch (error) {
|
|
619
|
+
if (error instanceof NonRealtimeTaskError) {
|
|
620
|
+
console.error(error.message, error.task);
|
|
621
|
+
} else {
|
|
622
|
+
throw error;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
- `submitTask()` returns immediately after acceptance and never automatically
|
|
628
|
+
retries. A timeout or invalid response may still mean the server created and
|
|
629
|
+
charged for the task; do not blindly resubmit.
|
|
630
|
+
- `waitForCompletion()` polls serially and retries transient query failures up to
|
|
631
|
+
three consecutive times by default, with backoff. A successful query resets the
|
|
632
|
+
retry count. Without `timeoutMs`, waiting continues until completion, failure, or
|
|
633
|
+
cancellation. `controller.abort()` stops local waiting and the in-flight query;
|
|
634
|
+
it does **not** cancel or refund the server task.
|
|
635
|
+
- `getTask(uid)` returns any task status, including `error`. Waiting for an `error`
|
|
636
|
+
task, or a completed task without a usable result, throws `NonRealtimeTaskError`
|
|
637
|
+
with the task snapshot attached.
|
|
638
|
+
- `getTasks([uid, ...])` queries up to 100 IDs. `listTasks({ pageNumber, pageSize,
|
|
639
|
+
status })` retrieves one page, newest first. Saved IDs can be queried or waited
|
|
640
|
+
on using a new manager instance.
|
|
641
|
+
- Upload local videos with `client.createStorageService().uploadVideo()` before
|
|
642
|
+
submitting a task. It shares the image upload options and progress callback,
|
|
643
|
+
uploads the original bytes via COS `putObject`, and returns a `StoredFile`.
|
|
644
|
+
It does not transcode or use multipart upload; COS simple upload supports files
|
|
645
|
+
up to [5GB](https://cloud.tencent.com/document/product/436/14113).
|
|
646
|
+
MIME inference supports MP4/M4V, MOV, WebM, AVI, MKV, and OGV; successful storage
|
|
647
|
+
does not guarantee that the task processor supports the file's codec or container.
|
|
648
|
+
|
|
649
|
+
### Downloading videos
|
|
650
|
+
|
|
651
|
+
Call this from a user-initiated action, such as a download button:
|
|
652
|
+
|
|
653
|
+
```typescript
|
|
654
|
+
await client.createStorageService().downloadVideo({
|
|
655
|
+
url: videoURL,
|
|
656
|
+
fileName: "video.mp4",
|
|
657
|
+
// signal: controller.signal, // Optional cancellation.
|
|
658
|
+
});
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
The method fetches the complete file as a Blob and then requests browser saving.
|
|
662
|
+
The URL must be directly accessible and allow CORS for cross-origin requests;
|
|
663
|
+
the SDK does not send API credentials or cookies to it. This requires a browser
|
|
664
|
+
document and retains the complete file until the browser takes over. Resolution
|
|
665
|
+
means saving was requested, not that the user saved the file to disk.
|
|
666
|
+
|
|
440
667
|
## Example Project
|
|
441
668
|
|
|
442
669
|
A complete example application featuring React is available in
|
|
@@ -190,4 +190,26 @@ declare enum VideoContentMode {
|
|
|
190
190
|
fill = "fill"
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
/**
|
|
194
|
+
* 单个视频视图最近采样窗口的呈现帧率,不代表屏幕实际刷新帧率。
|
|
195
|
+
*/
|
|
196
|
+
interface VideoRenderStatistics {
|
|
197
|
+
/**
|
|
198
|
+
* video 按浏览器 presentedFrames 增量计数;canvas 按实际呈现提交计数。
|
|
199
|
+
*/
|
|
200
|
+
readonly source: "video" | "canvas";
|
|
201
|
+
/**
|
|
202
|
+
* 原帧与插值帧的总呈现帧率,单位 fps。
|
|
203
|
+
*/
|
|
204
|
+
readonly frameRate: number;
|
|
205
|
+
/**
|
|
206
|
+
* 原帧呈现帧率,单位 fps。
|
|
207
|
+
*/
|
|
208
|
+
readonly originalFrameRate: number;
|
|
209
|
+
/**
|
|
210
|
+
* 插值帧呈现帧率,单位 fps;未开启插帧时为 0。
|
|
211
|
+
*/
|
|
212
|
+
readonly interpolatedFrameRate: number;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { CameraPosition as C, RealtimeVideoFormat as R, VideoContentMode as V, RealtimeVideoTrack as a, type VideoRenderStatistics as b, RealtimeVideoEncoderPreference as c, type RealtimeVideoFormatInit as d };
|
|
@@ -190,4 +190,26 @@ declare enum VideoContentMode {
|
|
|
190
190
|
fill = "fill"
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
/**
|
|
194
|
+
* 单个视频视图最近采样窗口的呈现帧率,不代表屏幕实际刷新帧率。
|
|
195
|
+
*/
|
|
196
|
+
interface VideoRenderStatistics {
|
|
197
|
+
/**
|
|
198
|
+
* video 按浏览器 presentedFrames 增量计数;canvas 按实际呈现提交计数。
|
|
199
|
+
*/
|
|
200
|
+
readonly source: "video" | "canvas";
|
|
201
|
+
/**
|
|
202
|
+
* 原帧与插值帧的总呈现帧率,单位 fps。
|
|
203
|
+
*/
|
|
204
|
+
readonly frameRate: number;
|
|
205
|
+
/**
|
|
206
|
+
* 原帧呈现帧率,单位 fps。
|
|
207
|
+
*/
|
|
208
|
+
readonly originalFrameRate: number;
|
|
209
|
+
/**
|
|
210
|
+
* 插值帧呈现帧率,单位 fps;未开启插帧时为 0。
|
|
211
|
+
*/
|
|
212
|
+
readonly interpolatedFrameRate: number;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { CameraPosition as C, RealtimeVideoFormat as R, VideoContentMode as V, RealtimeVideoTrack as a, type VideoRenderStatistics as b, RealtimeVideoEncoderPreference as c, type RealtimeVideoFormatInit as d };
|