@qaiddev/thumbs-embed 1.2.0 → 1.2.1

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.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * iOS/iPadOS screen-recording orientation fix.
3
+ *
4
+ * On iOS/iPadOS, `getDisplayMedia` + `MediaRecorder` writes a device-orientation
5
+ * rotation into the recorded file (even for screen captures). Players disagree
6
+ * on whether to honour it — the widget's own preview `<video>` renders it
7
+ * sideways, and so does the dashboard. Re-encoding the *live* decoded frames
8
+ * (which carry no container rotation) through a canvas produces a file whose
9
+ * pixels are already upright with no rotation metadata, so it renders the same
10
+ * everywhere.
11
+ *
12
+ * If the live frames themselves come back with swapped dimensions (portrait
13
+ * frame while the viewport is landscape, or vice versa), we additionally rotate
14
+ * the canvas 90° to match the viewport. That branch only triggers on a clear
15
+ * orientation mismatch, so a correctly-oriented recording is never rotated.
16
+ */
17
+ export interface OrientationTransform {
18
+ /** Output canvas width in px. */
19
+ width: number;
20
+ /** Output canvas height in px. */
21
+ height: number;
22
+ /** Clockwise rotation to apply while drawing: 0, 90, or -90. */
23
+ rotate: 0 | 90 | -90;
24
+ }
25
+ export interface OrientationCorrectedStream {
26
+ /** Canvas-sourced stream to hand to MediaRecorder. */
27
+ stream: MediaStream;
28
+ /** Stop drawing and release the canvas stream + source video. */
29
+ stop: () => void;
30
+ }
31
+ /** True on iPhone/iPad/iPod, including iPadOS 13+ which reports as desktop Mac. */
32
+ export declare function isIOSDevice(): boolean;
33
+ /**
34
+ * Decide the output canvas size and rotation needed to render a `frameW×frameH`
35
+ * capture upright for a `viewportW×viewportH` viewport. When the frame and
36
+ * viewport share an orientation, no rotation is applied (a straight re-encode,
37
+ * which still strips the bad container rotation). Otherwise rotate 90°, its
38
+ * direction chosen from the screen orientation angle.
39
+ */
40
+ export declare function computeOrientationTransform(frameW: number, frameH: number, viewportW: number, viewportH: number, screenAngle: number): OrientationTransform;
41
+ /** Draw one video frame onto the canvas context, applying the transform. */
42
+ export declare function drawRotatedFrame(ctx: CanvasRenderingContext2D, source: CanvasImageSource, t: OrientationTransform): void;
43
+ /**
44
+ * Build a canvas-backed, orientation-normalised copy of a display-capture
45
+ * stream. Returns null when the browser can't support the canvas pipeline, in
46
+ * which case the caller should record the original stream directly.
47
+ */
48
+ export declare function buildOrientationCorrectedStream(displayStream: MediaStream, frameRate?: number): Promise<OrientationCorrectedStream | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaiddev/thumbs-embed",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Precision User Feedback",
5
5
  "type": "module",
6
6
  "main": "./dist/qaid.umd.cjs",