From f0d0e51537bede0d5f019517a4210558799bb336 Mon Sep 17 00:00:00 2001 From: JonnyBurger Date: Thu, 6 Nov 2025 13:51:17 +0100 Subject: [PATCH] Inherit rotation from VideoFrame when constructing VideoSample from it --- src/sample.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sample.ts b/src/sample.ts index b66b636..34724e6 100644 --- a/src/sample.ts +++ b/src/sample.ts @@ -161,7 +161,10 @@ export class VideoSample implements Disposable { this.format = init.format; this.codedWidth = init.codedWidth!; this.codedHeight = init.codedHeight!; - this.rotation = init.rotation ?? 0; + this.rotation = init.rotation + ?? (typeof VideoFrame !== 'undefined' && data instanceof VideoFrame && 'rotation' in data + ? data.rotation as Rotation + : 0); this.timestamp = init.timestamp!; this.duration = init.duration ?? 0; this.colorSpace = new VideoColorSpace(init.colorSpace);