lecodes-sdk 2.2.7 → 2.2.9

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
+ // GENERATED by scripts/vendor-plugins.ts from lecodes-plugins/plugins/webrtc/sdk/webrtc.RtcVideo.gen.ts — do not edit here.
2
+ // Change it in the plugin repo and run `bun run vendor:plugins`; `bun run check:plugins` fails when this copy is stale.
3
+ // GENERATED by `lecodes plugin gen` from contract.d.ts — do not edit.
4
+ // webrtc: the view "rtcVideo", contract version 1.
5
+
6
+ import { ViewChannel } from "../../../../plugin"
7
+ import type { ObjectFit, RtcVideoEvents, RtcVideoParams } from "../contract"
8
+
9
+ /** What the halves register under. */
10
+ export const NAME = "rtcVideo"
11
+ /** The contract's version: the highest `@since` of its members. */
12
+ export const VERSION = 1
13
+
14
+ // ---- the wire, call by call ----------------------------------------------------------------------
15
+
16
+ /** Draw another track; null = black.
17
+ * Rejects with "notFound". */
18
+ export const setTrack = (view: ViewChannel<RtcVideoEvents>, trackId: string | null): Promise<void> =>
19
+ view._call("setTrack", [trackId])
20
+
21
+ export const setObjectFit = (view: ViewChannel<RtcVideoEvents>, fit: ObjectFit): Promise<void> =>
22
+ view._call("setObjectFit", [fit])
23
+
24
+ export const setMirror = (view: ViewChannel<RtcVideoEvents>, mirror: boolean): Promise<void> =>
25
+ view._call("setMirror", [mirror])
26
+
27
+ // ---- what the host's half has --------------------------------------------------------------------
28
+
29
+ /** A method of the contract. */
30
+ export type Method = "setTrack" | "setObjectFit" | "setMirror"
31
+
32
+ /** Whether this host has the view "rtcVideo" — and, given a method, a half new enough for it
33
+ * (a method added after the first version of the contract is tagged `@since`). */
34
+ export const supports = (method?: Method): boolean =>
35
+ ViewChannel.supports(NAME) // every method is of version 1
36
+
37
+ // ---- the element ----------------------------------------------------------------------------------
38
+
39
+ /** A view drawing one video track, local or remote. */
40
+ export class RtcVideoBase extends ViewChannel<RtcVideoEvents> {
41
+ constructor(params: RtcVideoParams = {}) { super("RtcVideo", NAME, params) }
42
+
43
+ /** Draw another track; null = black.
44
+ * Rejects with "notFound". */
45
+ setTrack(trackId: string | null): Promise<void> { return setTrack(this, trackId) }
46
+ setObjectFit(fit: ObjectFit): Promise<void> { return setObjectFit(this, fit) }
47
+ setMirror(mirror: boolean): Promise<void> { return setMirror(this, mirror) }
48
+ }