Skip to content

Visualize Your Ideas With Code

feat(2d): add video component property getter (#240)

Tan to the Dashi59de5ab2c089
diff --git a/packages/2d/src/components/Video.ts b/packages/2d/src/components/Video.ts
index a9ebea38..6fe4b822 100644
--- a/packages/2d/src/components/Video.ts
+++ b/packages/2d/src/components/Video.ts
@@ -51,6 +51,18 @@ export class Video extends Rect {
super(props);
}
+ public isPlaying(): boolean {
+ return this.playing();
+ }
+
+ public getCurrentTime(): number {
+ return this.time();
+ }
+
+ public getDuration(): number {
+ return this.video().duration;
+ }
+
protected override desiredSize(): SerializedVector2<Length> {
const custom = super.desiredSize();
if (custom.x === null && custom.y === null) {