MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / clone

Method clone

src/video_frame.ts:430–448  ·  view source on GitHub ↗

* Creates a copy of this frame.

()

Source from the content-addressed store, hash-verified

428 * Creates a copy of this frame.
429 */
430 clone(): VideoFramePolyfill {
431 this.ensureNotClosed();
432 assert(this.data);
433 assert(this.format !== null);
434
435 if (this.data instanceof Frame) {
436 const clone = this.data.clone();
437 if (!clone) {
438 throw new Error('Error obtaining frame clone.');
439 }
440 return new VideoFramePolyfill(clone, {
441 displayWidth: this.displayWidth,
442 displayHeight: this.displayHeight,
443 visibleRect: this.visibleRect ?? undefined,
444 });
445 } else {
446 return new VideoFramePolyfill(this);
447 }
448 }
449
450 /**
451 * Closes the frame and releases all resources.

Callers

nothing calls this directly

Calls 2

ensureNotClosedMethod · 0.95
assertFunction · 0.85

Tested by

no test coverage detected