lecodes-sdk 2.2.6 → 2.2.8

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.
package/dist/global.d.ts CHANGED
@@ -15,6 +15,7 @@ declare global {
15
15
  const AudioZone: typeof SDK.AudioZone
16
16
  const Autotile2D: typeof SDK.Autotile2D
17
17
  const Bitmap: typeof SDK.Bitmap
18
+ const Browser: typeof SDK.Browser
18
19
  const Bus: typeof SDK.Bus
19
20
  const Camera: typeof SDK.Camera
20
21
  const Camera2D: typeof SDK.Camera2D
@@ -57,6 +58,8 @@ declare global {
57
58
  const Material: typeof SDK.Material
58
59
  const MaterialHandle: typeof SDK.MaterialHandle
59
60
  const Mathf: typeof SDK.Mathf
61
+ const MediaStream: typeof SDK.MediaStream
62
+ const MediaStreamTrack: typeof SDK.MediaStreamTrack
60
63
  const Mesh: typeof SDK.Mesh
61
64
  const Model: typeof SDK.Model
62
65
  const MouseEnterEvent: typeof SDK.MouseEnterEvent
@@ -84,6 +87,15 @@ declare global {
84
87
  const QRScanner: typeof SDK.QRScanner
85
88
  const Quat: typeof SDK.Quat
86
89
  const REVERB_PRESETS: typeof SDK.REVERB_PRESETS
90
+ const RTCDataChannel: typeof SDK.RTCDataChannel
91
+ const RTCEventTarget: typeof SDK.RTCEventTarget
92
+ const RTCIceCandidate: typeof SDK.RTCIceCandidate
93
+ const RTCPeerConnection: typeof SDK.RTCPeerConnection
94
+ const RTCRtpReceiver: typeof SDK.RTCRtpReceiver
95
+ const RTCRtpSender: typeof SDK.RTCRtpSender
96
+ const RTCRtpTransceiver: typeof SDK.RTCRtpTransceiver
97
+ const RTCSessionDescription: typeof SDK.RTCSessionDescription
98
+ const RTCVideoView: typeof SDK.RTCVideoView
87
99
  const Ragdoll: typeof SDK.Ragdoll
88
100
  const Ray: typeof SDK.Ray
89
101
  const Replicated: typeof SDK.Replicated
@@ -144,6 +156,7 @@ declare global {
144
156
  const Voice: typeof SDK.Voice
145
157
  const Warp: typeof SDK.Warp
146
158
  const WebSocket: typeof SDK.WebSocket
159
+ const WebView: typeof SDK.WebView
147
160
  const Wheel: typeof SDK.Wheel
148
161
  const __UIBox: typeof SDK.__UIBox
149
162
  const __UIButton: typeof SDK.__UIButton
@@ -191,6 +204,7 @@ declare global {
191
204
  const isRawCell: typeof SDK.isRawCell
192
205
  const localStorage: typeof SDK.localStorage
193
206
  const make: typeof SDK.make
207
+ const mediaDevices: typeof SDK.mediaDevices
194
208
  const openFilePicker: typeof SDK.openFilePicker
195
209
  const openURL: typeof SDK.openURL
196
210
  const packTile: typeof SDK.packTile
@@ -238,6 +252,7 @@ declare global {
238
252
  type BlendMember = SDK.BlendMember
239
253
  type BlendPosition = SDK.BlendPosition
240
254
  type BlockEntry = SDK.BlockEntry
255
+ type BrowserOpenOptions = SDK.BrowserOpenOptions
241
256
  type Bus = SDK.Bus
242
257
  type Camera = SDK.Camera
243
258
  type Camera2D = SDK.Camera2D
@@ -376,6 +391,9 @@ declare global {
376
391
  type MaterialDef = SDK.MaterialDef
377
392
  type MaterialHandle = SDK.MaterialHandle
378
393
  type MaterialParamValue = SDK.MaterialParamValue
394
+ type MediaStream = SDK.MediaStream
395
+ type MediaStreamConstraints = SDK.MediaStreamConstraints
396
+ type MediaStreamTrack = SDK.MediaStreamTrack
379
397
  type Mesh = SDK.Mesh
380
398
  type MeshDef = SDK.MeshDef
381
399
  type Model = SDK.Model
@@ -433,6 +451,25 @@ declare global {
433
451
  type PushStatus = SDK.PushStatus
434
452
  type QRScanner = SDK.QRScanner
435
453
  type Quat = SDK.Quat
454
+ type RTCConfiguration = SDK.RTCConfiguration
455
+ type RTCDataChannel = SDK.RTCDataChannel
456
+ type RTCDataChannelEvent = SDK.RTCDataChannelEvent
457
+ type RTCErrorEvent = SDK.RTCErrorEvent
458
+ type RTCEvent<T extends RTCEventTarget = RTCEventTarget> = SDK.RTCEvent<T>
459
+ type RTCEventListener<E> = SDK.RTCEventListener<E>
460
+ type RTCEventTarget = SDK.RTCEventTarget
461
+ type RTCIceCandidate = SDK.RTCIceCandidate
462
+ type RTCIceCandidateInit = SDK.RTCIceCandidateInit
463
+ type RTCMessageEvent = SDK.RTCMessageEvent
464
+ type RTCPeerConnection = SDK.RTCPeerConnection
465
+ type RTCPeerConnectionIceEvent = SDK.RTCPeerConnectionIceEvent
466
+ type RTCRtpReceiver = SDK.RTCRtpReceiver
467
+ type RTCRtpSender = SDK.RTCRtpSender
468
+ type RTCRtpTransceiver = SDK.RTCRtpTransceiver
469
+ type RTCSessionDescription = SDK.RTCSessionDescription
470
+ type RTCTrackEvent = SDK.RTCTrackEvent
471
+ type RTCVideoView = SDK.RTCVideoView
472
+ type RTCVideoViewOptions = SDK.RTCVideoViewOptions
436
473
  type Ragdoll = SDK.Ragdoll
437
474
  type RagdollActivateOptions = SDK.RagdollActivateOptions
438
475
  type RagdollDeactivateOptions = SDK.RagdollDeactivateOptions
@@ -581,6 +618,9 @@ declare global {
581
618
  type Warp = SDK.Warp
582
619
  type WarpOptions = SDK.WarpOptions
583
620
  type WebSocket = SDK.WebSocket
621
+ type WebView = SDK.WebView
622
+ type WebViewEvents = SDK.WebViewEvents
623
+ type WebViewParams = SDK.WebViewParams
584
624
  type Wheel = SDK.Wheel
585
625
  type WheelSuspension = SDK.WheelSuspension
586
626
  type WidgetSet<Owner> = SDK.WidgetSet<Owner>
@@ -73,6 +73,8 @@ export { CameraView, type CameraFacing } from "./plugins/gen/camera/sdk/camera";
73
73
  export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from "./plugins/gen/geolocation/sdk/geolocation";
74
74
  export { MapView, type MapOptions, type MapStyle, type MapStyleName, type MapCamera, type MapTap, type LngLat, type CameraMove, type FitOptions, type MapPaddingValues, type MarkerItem, type MarkerTap, type MarkerLayer, type MarkerLayerOptions, type LineLayer, type LineLayerOptions, type UserLocationOptions, } from "./plugins/gen/map/sdk/map";
75
75
  export { Push, type PushPayload, type PushStatus, type PushRegisterOptions, type PushEvent } from "./plugins/gen/push/sdk/push";
76
+ export { Browser, WebView, type BrowserOpenOptions, type WebViewParams, type WebViewEvents } from "./plugins/gen/browser/sdk/browser";
77
+ export { RTCPeerConnection, MediaStream, MediaStreamTrack, RTCDataChannel, RTCRtpSender, RTCRtpReceiver, RTCRtpTransceiver, RTCSessionDescription, RTCIceCandidate, RTCEventTarget, mediaDevices, RTCVideoView, type RTCConfiguration, type RTCVideoViewOptions, type MediaStreamConstraints, type RTCIceCandidateInit, type RTCPeerConnectionIceEvent, type RTCTrackEvent, type RTCDataChannelEvent, type RTCMessageEvent, type RTCErrorEvent, type RTCEvent, type RTCEventListener, } from "./plugins/gen/webrtc/sdk/webrtc";
76
78
  export { Service } from "./plugins/service";
77
79
  export { defineScene, use, ref, make, SceneHandle } from "./scene/defineScene";
78
80
  export { defineMaterial, MaterialHandle } from "./scene/material";
@@ -2,6 +2,8 @@ import { File as HostFile } from "./runtime/fetch";
2
2
  import { ServiceClient } from "./runtime/service";
3
3
  import { NativeViewElement } from "./ui/NativeView";
4
4
  export type { PresentOptions } from "./ui/presentable";
5
+ export { Presentable, Router, UIBox, UIButton, UIColumn, UIRow, UIScreen, UIText } from "./ui/UI";
6
+ export { theme } from "./ui/theme";
5
7
  export type { NativeView } from "./ui/NativeView";
6
8
  export type { FetchResponse } from "./runtime/fetch";
7
9
  /** Signed 32-bit integer on the wire. */
@@ -67,6 +69,9 @@ export declare class ServiceChannel<Events extends object = {}> extends ServiceC
67
69
  on<K extends keyof Events & string>(event: K, callback: Listener<Events, K>): this;
68
70
  off<K extends keyof Events & string>(event: K, callback: Listener<Events, K>): this;
69
71
  }
72
+ /** Hear the app's "url" events (a deep link while the app runs — an OAuth redirect, a checkout's
73
+ * return) until the returned function is called. The listener the `app` global fans out from. */
74
+ export declare const _onAppUrl: (callback: (url: string) => void) => (() => void);
70
75
  /** The text of a host buffer — what a bundled `asset()` is in a shell compile (`"id:N"`): the host
71
76
  * already holds the bytes. Empty when there is no such buffer. */
72
77
  export declare const bufferText: (systemId: number) => string;
@@ -0,0 +1,27 @@
1
+ import { ServiceChannel } from "../../../../plugin";
2
+ import type { BrowserEvents, BrowserOpenOptions, BrowserParams, BrowserResult } from "../contract";
3
+ /** What the halves register under. */
4
+ export declare const NAME = "browser";
5
+ /** The contract's version: the highest `@since` of its members. */
6
+ export declare const VERSION = 1;
7
+ /** Show `url` in the system's in-app browser sheet. Resolves when the sheet is dismissed — with
8
+ * the callback URL when the platform intercepted one. One sheet at a time.
9
+ * Rejects with "busy" / "invalid". */
10
+ export declare const show: (service: ServiceChannel<BrowserEvents>, url: string, options?: BrowserOpenOptions) => Promise<BrowserResult>;
11
+ /** Dismiss the sheet; a no-op without one. */
12
+ export declare const dismiss: (service: ServiceChannel<BrowserEvents>) => Promise<void>;
13
+ /** A method of the contract. */
14
+ export type Method = "show" | "dismiss";
15
+ /** Whether this host has the service "browser" — and, given a method, a half new enough for it
16
+ * (a method added after the first version of the contract is tagged `@since`). */
17
+ export declare const supports: (method?: Method) => boolean;
18
+ /** The service "browser" with the wire's methods as its own. */
19
+ export declare class BrowserBase extends ServiceChannel<BrowserEvents> {
20
+ constructor(params?: BrowserParams);
21
+ /** Show `url` in the system's in-app browser sheet. Resolves when the sheet is dismissed — with
22
+ * the callback URL when the platform intercepted one. One sheet at a time.
23
+ * Rejects with "busy" / "invalid". */
24
+ show(url: string, options?: BrowserOpenOptions): Promise<BrowserResult>;
25
+ /** Dismiss the sheet; a no-op without one. */
26
+ dismiss(): Promise<void>;
27
+ }
@@ -0,0 +1,61 @@
1
+ import { ViewChannel, type Json } from "../../../../plugin";
2
+ import type { WebViewEvents, WebViewParams } from "../contract";
3
+ /** What the halves register under. */
4
+ export declare const NAME = "webView";
5
+ /** The contract's version: the highest `@since` of its members. */
6
+ export declare const VERSION = 1;
7
+ /** Load `url`, with extra request headers for the first request.
8
+ * Rejects with "invalid". */
9
+ export declare const load: (view: ViewChannel<WebViewEvents>, url: string, headers?: {
10
+ [key: string]: string;
11
+ }) => Promise<void>;
12
+ /** Show `html` as the page; relative URLs in it resolve against `baseUrl`. */
13
+ export declare const loadHtml: (view: ViewChannel<WebViewEvents>, html: string, baseUrl?: string) => Promise<void>;
14
+ /** Replace the stop list (see WebViewParams.stops). */
15
+ export declare const setStops: (view: ViewChannel<WebViewEvents>, stops: string[]) => Promise<void>;
16
+ export declare const reload: (view: ViewChannel<WebViewEvents>) => Promise<void>;
17
+ /** Stop the current load. */
18
+ export declare const stopLoading: (view: ViewChannel<WebViewEvents>) => Promise<void>;
19
+ export declare const goBack: (view: ViewChannel<WebViewEvents>) => Promise<void>;
20
+ export declare const goForward: (view: ViewChannel<WebViewEvents>) => Promise<void>;
21
+ export declare const canGoBack: (view: ViewChannel<WebViewEvents>) => Promise<boolean>;
22
+ /** Run `js` in the page and return what it evaluates to, as JSON. On iOS this disables Apple Pay
23
+ * in the view until its next navigation.
24
+ * Rejects with "failed". */
25
+ export declare const evaluate: (view: ViewChannel<WebViewEvents>, js: string) => Promise<Json>;
26
+ /** Deliver `data` to the page's `window.lecodes.onMessage(data)` (with `bridge`). */
27
+ export declare const postMessage: (view: ViewChannel<WebViewEvents>, data: Json) => Promise<void>;
28
+ /** Clear the cookies and the storage of this view's session. */
29
+ export declare const clearData: (view: ViewChannel<WebViewEvents>) => Promise<void>;
30
+ /** A method of the contract. */
31
+ export type Method = "load" | "loadHtml" | "setStops" | "reload" | "stopLoading" | "goBack" | "goForward" | "canGoBack" | "evaluate" | "postMessage" | "clearData";
32
+ /** Whether this host has the view "webView" — 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 declare const supports: (method?: Method) => boolean;
35
+ /** The view "webView" with the wire's methods as its own. */
36
+ export declare class WebViewBase extends ViewChannel<WebViewEvents> {
37
+ constructor(params?: WebViewParams);
38
+ /** Load `url`, with extra request headers for the first request.
39
+ * Rejects with "invalid". */
40
+ load(url: string, headers?: {
41
+ [key: string]: string;
42
+ }): Promise<void>;
43
+ /** Show `html` as the page; relative URLs in it resolve against `baseUrl`. */
44
+ loadHtml(html: string, baseUrl?: string): Promise<void>;
45
+ /** Replace the stop list (see WebViewParams.stops). */
46
+ setStops(stops: string[]): Promise<void>;
47
+ reload(): Promise<void>;
48
+ /** Stop the current load. */
49
+ stopLoading(): Promise<void>;
50
+ goBack(): Promise<void>;
51
+ goForward(): Promise<void>;
52
+ canGoBack(): Promise<boolean>;
53
+ /** Run `js` in the page and return what it evaluates to, as JSON. On iOS this disables Apple Pay
54
+ * in the view until its next navigation.
55
+ * Rejects with "failed". */
56
+ evaluate(js: string): Promise<Json>;
57
+ /** Deliver `data` to the page's `window.lecodes.onMessage(data)` (with `bridge`). */
58
+ postMessage(data: Json): Promise<void>;
59
+ /** Clear the cookies and the storage of this view's session. */
60
+ clearData(): Promise<void>;
61
+ }
@@ -0,0 +1,71 @@
1
+ import { type Json, type Listener, type NativeView } from "../../../../plugin";
2
+ import { type Method as WebViewMethod } from "./browser.WebView.gen";
3
+ import type { WebViewEvents, WebViewParams } from "../contract";
4
+ export type { WebViewEvents, WebViewParams } from "../contract";
5
+ export interface BrowserOpenOptions {
6
+ /** What ends the page: a URL prefix, or several (a checkout's success and failure URLs). The
7
+ * promise resolves with the URL reached. In the sheet every prefix must share one scheme — the
8
+ * platform intercepts one; a custom scheme needs app.json `urlScheme`, an https one the app's
9
+ * verified links. */
10
+ returnUrl?: string | string[];
11
+ /** Run the page in an embedded WebView under a close bar instead of the system sheet. The
12
+ * WebView intercepts any return URL itself, https included. */
13
+ embedded?: boolean;
14
+ /** A private session: no cookies shared with the system browser, nothing kept after. */
15
+ ephemeral?: boolean;
16
+ /** The sheet's tint, "#RRGGBB". */
17
+ color?: string;
18
+ /** Embedded: the bar's title until the page reports its own. */
19
+ title?: string;
20
+ }
21
+ /** The embedded page — the element of the "webView" view: embeddable among a screen's children,
22
+ * presentable (`open()`, `Router.push`), with the page's controls and events. */
23
+ export interface WebView extends NativeView {
24
+ /** Load `url`, with extra request headers for the first request. Rejects "invalid" for a URL
25
+ * that is not a web one. */
26
+ load(url: string, headers?: {
27
+ [name: string]: string;
28
+ }): Promise<void>;
29
+ /** Show `html` as the page; relative URLs in it resolve against `baseUrl`. */
30
+ loadHtml(html: string, baseUrl?: string): Promise<void>;
31
+ /** Replace the URL prefixes that end a navigation with the `stop` event. */
32
+ setStops(stops: string[]): Promise<void>;
33
+ reload(): Promise<void>;
34
+ /** Stop the current load. */
35
+ stopLoading(): Promise<void>;
36
+ goBack(): Promise<void>;
37
+ goForward(): Promise<void>;
38
+ canGoBack(): Promise<boolean>;
39
+ /** Run `js` in the page and get what it evaluates to, as JSON. On iOS this disables Apple Pay
40
+ * in the view until its next navigation. */
41
+ evaluate(js: string): Promise<Json>;
42
+ /** Deliver `data` to the page's `window.lecodes.onMessage(data)` (a view created with `bridge`). */
43
+ postMessage(data: Json): Promise<void>;
44
+ /** Clear the cookies and the storage of this view's session. */
45
+ clearData(): Promise<void>;
46
+ /** The page's events: `navigate`, `load`, `error`, `stop`, `message`, `exit`. */
47
+ on<K extends keyof WebViewEvents & string>(event: K, callback: Listener<WebViewEvents, K>): this;
48
+ off<K extends keyof WebViewEvents & string>(event: K, callback: Listener<WebViewEvents, K>): this;
49
+ }
50
+ /**
51
+ * Web content inside the app. `Browser.isSupported` reports whether this host registered the
52
+ * system sheet; `WebView.isSupported` the embedded page.
53
+ */
54
+ export declare const Browser: {
55
+ /** Whether this host registered the "browser" service — the system sheet. */
56
+ readonly isSupported: boolean;
57
+ /** Open `url`: in the system sheet, or (`embedded`) in a WebView under a close bar. Resolves
58
+ * with the return URL reached (`returnUrl`), or null when the user left. */
59
+ open(url: string, options?: BrowserOpenOptions): Promise<string | null>;
60
+ };
61
+ /**
62
+ * Create an embedded page. `WebView.isSupported` reports whether this host has the capability —
63
+ * check it before offering the feature.
64
+ */
65
+ export declare const WebView: {
66
+ (params?: WebViewParams): WebView;
67
+ /** Whether this host registered a "webView" view. */
68
+ readonly isSupported: boolean;
69
+ /** Whether the host's half has `method`: false on a host whose half is older than it. */
70
+ supports(method: WebViewMethod): boolean;
71
+ };
@@ -0,0 +1,55 @@
1
+ import { ServiceChannel } from "../../../../plugin";
2
+ import type { AudioOutput, DeviceInfo, MediaConstraints, RtcMediaEvents, RtcMediaParams, StreamInfo, TrackSettings, VideoConstraints } from "../contract";
3
+ /** What the halves register under. */
4
+ export declare const NAME = "rtcMedia";
5
+ /** The contract's version: the highest `@since` of its members. */
6
+ export declare const VERSION = 1;
7
+ /** Capture: prompts for the permissions it needs, resolves with a stream of the new tracks.
8
+ * Rejects with "denied" / "notFound" / "failed". */
9
+ export declare const getUserMedia: (service: ServiceChannel<RtcMediaEvents>, constraints: MediaConstraints) => Promise<StreamInfo>;
10
+ /** The devices the host can capture with (labels need a granted permission on the web). */
11
+ export declare const enumerateDevices: (service: ServiceChannel<RtcMediaEvents>) => Promise<DeviceInfo[]>;
12
+ /** A disabled track sends silence / black frames and stays in every connection.
13
+ * Rejects with "notFound". */
14
+ export declare const setTrackEnabled: (service: ServiceChannel<RtcMediaEvents>, trackId: string, enabled: boolean) => Promise<void>;
15
+ /** Re-aim a local video track: the other camera, another size or rate. The track and its id
16
+ * stay; every connection keeps sending it.
17
+ * Rejects with "notFound" / "failed". */
18
+ export declare const applyConstraints: (service: ServiceChannel<RtcMediaEvents>, trackId: string, constraints: VideoConstraints) => Promise<void>;
19
+ /** Rejects with "notFound". */
20
+ export declare const getTrackSettings: (service: ServiceChannel<RtcMediaEvents>, trackId: string) => Promise<TrackSettings>;
21
+ /** End a track: the device is released once no track of it is left, every sender of it goes
22
+ * quiet, the id is forgotten. A no-op for an unknown id. */
23
+ export declare const stopTrack: (service: ServiceChannel<RtcMediaEvents>, trackId: string) => Promise<void>;
24
+ /** Route the audio of the call: the earpiece (the default while a wired or Bluetooth headset is
25
+ * not connected) or the loudspeaker. A no-op on the web. */
26
+ export declare const setAudioOutput: (service: ServiceChannel<RtcMediaEvents>, output: AudioOutput) => Promise<void>;
27
+ /** A method of the contract. */
28
+ export type Method = "getUserMedia" | "enumerateDevices" | "setTrackEnabled" | "applyConstraints" | "getTrackSettings" | "stopTrack" | "setAudioOutput";
29
+ /** Whether this host has the service "rtcMedia" — and, given a method, a half new enough for it
30
+ * (a method added after the first version of the contract is tagged `@since`). */
31
+ export declare const supports: (method?: Method) => boolean;
32
+ /** The devices: capture, the device list, the audio route. One session for the app. */
33
+ export declare class RtcMediaBase extends ServiceChannel<RtcMediaEvents> {
34
+ constructor(params?: RtcMediaParams);
35
+ /** Capture: prompts for the permissions it needs, resolves with a stream of the new tracks.
36
+ * Rejects with "denied" / "notFound" / "failed". */
37
+ getUserMedia(constraints: MediaConstraints): Promise<StreamInfo>;
38
+ /** The devices the host can capture with (labels need a granted permission on the web). */
39
+ enumerateDevices(): Promise<DeviceInfo[]>;
40
+ /** A disabled track sends silence / black frames and stays in every connection.
41
+ * Rejects with "notFound". */
42
+ setTrackEnabled(trackId: string, enabled: boolean): Promise<void>;
43
+ /** Re-aim a local video track: the other camera, another size or rate. The track and its id
44
+ * stay; every connection keeps sending it.
45
+ * Rejects with "notFound" / "failed". */
46
+ applyConstraints(trackId: string, constraints: VideoConstraints): Promise<void>;
47
+ /** Rejects with "notFound". */
48
+ getTrackSettings(trackId: string): Promise<TrackSettings>;
49
+ /** End a track: the device is released once no track of it is left, every sender of it goes
50
+ * quiet, the id is forgotten. A no-op for an unknown id. */
51
+ stopTrack(trackId: string): Promise<void>;
52
+ /** Route the audio of the call: the earpiece (the default while a wired or Bluetooth headset is
53
+ * not connected) or the loudspeaker. A no-op on the web. */
54
+ setAudioOutput(output: AudioOutput): Promise<void>;
55
+ }
@@ -0,0 +1,121 @@
1
+ import { ServiceChannel, type Json } from "../../../../plugin";
2
+ import type { DataChannelInfo, DataChannelInit, IceCandidate, MediaKind, OfferOptions, RtcConfiguration, RtcPeerConnectionEvents, SenderInfo, SenderParameters, SessionDescription, TransceiverDirection, TransceiverInfo, TransceiverInit } from "../contract";
3
+ /** What the halves register under. */
4
+ export declare const NAME = "rtcPeerConnection";
5
+ /** The contract's version: the highest `@since` of its members. */
6
+ export declare const VERSION = 1;
7
+ /** Rejects with "failed" / "closed". */
8
+ export declare const createOffer: (service: ServiceChannel<RtcPeerConnectionEvents>, options?: OfferOptions) => Promise<SessionDescription>;
9
+ /** Rejects with "failed" / "closed". */
10
+ export declare const createAnswer: (service: ServiceChannel<RtcPeerConnectionEvents>) => Promise<SessionDescription>;
11
+ /** Without a description: the implicit form — an answer when a remote offer is pending, an
12
+ * offer otherwise. Resolves with the description now in force (the one to signal).
13
+ * Rejects with "failed" / "closed". */
14
+ export declare const setLocalDescription: (service: ServiceChannel<RtcPeerConnectionEvents>, description?: SessionDescription) => Promise<SessionDescription>;
15
+ /** Rejects with "failed" / "closed". */
16
+ export declare const setRemoteDescription: (service: ServiceChannel<RtcPeerConnectionEvents>, description: SessionDescription) => Promise<void>;
17
+ /** Without a candidate: the end of the remote candidates.
18
+ * Rejects with "failed" / "closed". */
19
+ export declare const addIceCandidate: (service: ServiceChannel<RtcPeerConnectionEvents>, candidate?: IceCandidate) => Promise<void>;
20
+ /** The next offer carries new ICE credentials. */
21
+ export declare const restartIce: (service: ServiceChannel<RtcPeerConnectionEvents>) => Promise<void>;
22
+ /** Rejects with "failed". */
23
+ export declare const setConfiguration: (service: ServiceChannel<RtcPeerConnectionEvents>, configuration: RtcConfiguration) => Promise<void>;
24
+ /** Send a local track, in the streams named (one is made up when none is).
25
+ * Rejects with "notFound" / "failed" / "closed". */
26
+ export declare const addTrack: (service: ServiceChannel<RtcPeerConnectionEvents>, trackId: string, streamIds?: string[]) => Promise<SenderInfo>;
27
+ /** Rejects with "notFound" / "closed". */
28
+ export declare const removeTrack: (service: ServiceChannel<RtcPeerConnectionEvents>, senderId: string) => Promise<void>;
29
+ /** Swap what a sender sends without renegotiating; null = send nothing.
30
+ * Rejects with "notFound" / "failed" / "closed". */
31
+ export declare const replaceTrack: (service: ServiceChannel<RtcPeerConnectionEvents>, senderId: string, trackId: string | null) => Promise<void>;
32
+ /** Rejects with "notFound". */
33
+ export declare const getSenderParameters: (service: ServiceChannel<RtcPeerConnectionEvents>, senderId: string) => Promise<SenderParameters>;
34
+ /** The encodings' active / bitrate / scale; the layers themselves are set at addTransceiver.
35
+ * Rejects with "notFound" / "failed". */
36
+ export declare const setSenderParameters: (service: ServiceChannel<RtcPeerConnectionEvents>, senderId: string, parameters: SenderParameters) => Promise<void>;
37
+ /** Rejects with "notFound" / "failed" / "closed". */
38
+ export declare const addTransceiver: (service: ServiceChannel<RtcPeerConnectionEvents>, kind: MediaKind, options?: TransceiverInit) => Promise<TransceiverInfo>;
39
+ export declare const getTransceivers: (service: ServiceChannel<RtcPeerConnectionEvents>) => Promise<TransceiverInfo[]>;
40
+ /** Rejects with "notFound" / "failed". */
41
+ export declare const setTransceiverDirection: (service: ServiceChannel<RtcPeerConnectionEvents>, transceiverId: string, direction: TransceiverDirection) => Promise<void>;
42
+ /** Rejects with "notFound". */
43
+ export declare const stopTransceiver: (service: ServiceChannel<RtcPeerConnectionEvents>, transceiverId: string) => Promise<void>;
44
+ /** The RTCStatsReport as an object: the stats id → the stats object (`type`, `timestamp` in ms,
45
+ * the fields of its type). For one track's senders / receivers when `trackId` is given. */
46
+ export declare const getStats: (service: ServiceChannel<RtcPeerConnectionEvents>, trackId?: string) => Promise<Json>;
47
+ /** Rejects with "failed" / "closed". */
48
+ export declare const createDataChannel: (service: ServiceChannel<RtcPeerConnectionEvents>, label: string, options?: DataChannelInit) => Promise<DataChannelInfo>;
49
+ /** Rejects with "notFound" / "closed". */
50
+ export declare const sendText: (service: ServiceChannel<RtcPeerConnectionEvents>, channelId: string, text: string) => Promise<void>;
51
+ /** Rejects with "notFound" / "closed". */
52
+ export declare const sendBinary: (service: ServiceChannel<RtcPeerConnectionEvents>, channelId: string, data: Uint8Array) => Promise<void>;
53
+ /** Bytes queued and not yet sent.
54
+ * Rejects with "notFound". */
55
+ export declare const getBufferedAmount: (service: ServiceChannel<RtcPeerConnectionEvents>, channelId: string) => Promise<number>;
56
+ /** Rejects with "notFound". */
57
+ export declare const setBufferedAmountLowThreshold: (service: ServiceChannel<RtcPeerConnectionEvents>, channelId: string, threshold: number) => Promise<void>;
58
+ /** A no-op for an unknown id. */
59
+ export declare const closeDataChannel: (service: ServiceChannel<RtcPeerConnectionEvents>, channelId: string) => Promise<void>;
60
+ /** A method of the contract. */
61
+ export type Method = "createOffer" | "createAnswer" | "setLocalDescription" | "setRemoteDescription" | "addIceCandidate" | "restartIce" | "setConfiguration" | "addTrack" | "removeTrack" | "replaceTrack" | "getSenderParameters" | "setSenderParameters" | "addTransceiver" | "getTransceivers" | "setTransceiverDirection" | "stopTransceiver" | "getStats" | "createDataChannel" | "sendText" | "sendBinary" | "getBufferedAmount" | "setBufferedAmountLowThreshold" | "closeDataChannel";
62
+ /** Whether this host has the service "rtcPeerConnection" — and, given a method, a half new enough for it
63
+ * (a method added after the first version of the contract is tagged `@since`). */
64
+ export declare const supports: (method?: Method) => boolean;
65
+ /** One RTCPeerConnection: a session, created with its configuration, closed by the SDK's close(). */
66
+ export declare class RtcPeerConnectionBase extends ServiceChannel<RtcPeerConnectionEvents> {
67
+ constructor(params?: RtcConfiguration);
68
+ /** Rejects with "failed" / "closed". */
69
+ createOffer(options?: OfferOptions): Promise<SessionDescription>;
70
+ /** Rejects with "failed" / "closed". */
71
+ createAnswer(): Promise<SessionDescription>;
72
+ /** Without a description: the implicit form — an answer when a remote offer is pending, an
73
+ * offer otherwise. Resolves with the description now in force (the one to signal).
74
+ * Rejects with "failed" / "closed". */
75
+ setLocalDescription(description?: SessionDescription): Promise<SessionDescription>;
76
+ /** Rejects with "failed" / "closed". */
77
+ setRemoteDescription(description: SessionDescription): Promise<void>;
78
+ /** Without a candidate: the end of the remote candidates.
79
+ * Rejects with "failed" / "closed". */
80
+ addIceCandidate(candidate?: IceCandidate): Promise<void>;
81
+ /** The next offer carries new ICE credentials. */
82
+ restartIce(): Promise<void>;
83
+ /** Rejects with "failed". */
84
+ setConfiguration(configuration: RtcConfiguration): Promise<void>;
85
+ /** Send a local track, in the streams named (one is made up when none is).
86
+ * Rejects with "notFound" / "failed" / "closed". */
87
+ addTrack(trackId: string, streamIds?: string[]): Promise<SenderInfo>;
88
+ /** Rejects with "notFound" / "closed". */
89
+ removeTrack(senderId: string): Promise<void>;
90
+ /** Swap what a sender sends without renegotiating; null = send nothing.
91
+ * Rejects with "notFound" / "failed" / "closed". */
92
+ replaceTrack(senderId: string, trackId: string | null): Promise<void>;
93
+ /** Rejects with "notFound". */
94
+ getSenderParameters(senderId: string): Promise<SenderParameters>;
95
+ /** The encodings' active / bitrate / scale; the layers themselves are set at addTransceiver.
96
+ * Rejects with "notFound" / "failed". */
97
+ setSenderParameters(senderId: string, parameters: SenderParameters): Promise<void>;
98
+ /** Rejects with "notFound" / "failed" / "closed". */
99
+ addTransceiver(kind: MediaKind, options?: TransceiverInit): Promise<TransceiverInfo>;
100
+ getTransceivers(): Promise<TransceiverInfo[]>;
101
+ /** Rejects with "notFound" / "failed". */
102
+ setTransceiverDirection(transceiverId: string, direction: TransceiverDirection): Promise<void>;
103
+ /** Rejects with "notFound". */
104
+ stopTransceiver(transceiverId: string): Promise<void>;
105
+ /** The RTCStatsReport as an object: the stats id → the stats object (`type`, `timestamp` in ms,
106
+ * the fields of its type). For one track's senders / receivers when `trackId` is given. */
107
+ getStats(trackId?: string): Promise<Json>;
108
+ /** Rejects with "failed" / "closed". */
109
+ createDataChannel(label: string, options?: DataChannelInit): Promise<DataChannelInfo>;
110
+ /** Rejects with "notFound" / "closed". */
111
+ sendText(channelId: string, text: string): Promise<void>;
112
+ /** Rejects with "notFound" / "closed". */
113
+ sendBinary(channelId: string, data: Uint8Array): Promise<void>;
114
+ /** Bytes queued and not yet sent.
115
+ * Rejects with "notFound". */
116
+ getBufferedAmount(channelId: string): Promise<number>;
117
+ /** Rejects with "notFound". */
118
+ setBufferedAmountLowThreshold(channelId: string, threshold: number): Promise<void>;
119
+ /** A no-op for an unknown id. */
120
+ closeDataChannel(channelId: string): Promise<void>;
121
+ }
@@ -0,0 +1,25 @@
1
+ import { ViewChannel } from "../../../../plugin";
2
+ import type { ObjectFit, RtcVideoEvents, RtcVideoParams } from "../contract";
3
+ /** What the halves register under. */
4
+ export declare const NAME = "rtcVideo";
5
+ /** The contract's version: the highest `@since` of its members. */
6
+ export declare const VERSION = 1;
7
+ /** Draw another track; null = black.
8
+ * Rejects with "notFound". */
9
+ export declare const setTrack: (view: ViewChannel<RtcVideoEvents>, trackId: string | null) => Promise<void>;
10
+ export declare const setObjectFit: (view: ViewChannel<RtcVideoEvents>, fit: ObjectFit) => Promise<void>;
11
+ export declare const setMirror: (view: ViewChannel<RtcVideoEvents>, mirror: boolean) => Promise<void>;
12
+ /** A method of the contract. */
13
+ export type Method = "setTrack" | "setObjectFit" | "setMirror";
14
+ /** Whether this host has the view "rtcVideo" — and, given a method, a half new enough for it
15
+ * (a method added after the first version of the contract is tagged `@since`). */
16
+ export declare const supports: (method?: Method) => boolean;
17
+ /** A view drawing one video track, local or remote. */
18
+ export declare class RtcVideoBase extends ViewChannel<RtcVideoEvents> {
19
+ constructor(params?: RtcVideoParams);
20
+ /** Draw another track; null = black.
21
+ * Rejects with "notFound". */
22
+ setTrack(trackId: string | null): Promise<void>;
23
+ setObjectFit(fit: ObjectFit): Promise<void>;
24
+ setMirror(mirror: boolean): Promise<void>;
25
+ }