lecodes-sdk 2.2.7 → 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 +34 -0
- package/dist/types/inject.d.ts +1 -0
- package/dist/types/plugins/gen/webrtc/sdk/webrtc.RtcMedia.gen.d.ts +55 -0
- package/dist/types/plugins/gen/webrtc/sdk/webrtc.RtcPeerConnection.gen.d.ts +121 -0
- package/dist/types/plugins/gen/webrtc/sdk/webrtc.RtcVideo.gen.d.ts +25 -0
- package/dist/types/plugins/gen/webrtc/sdk/webrtc.d.ts +328 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types.json +1 -1
- package/package.json +1 -1
- package/src/chisel.ts +2 -2
- package/src/inject.ts +7 -0
- package/src/plugins/gen/webrtc/contract.d.ts +342 -0
- package/src/plugins/gen/webrtc/sdk/webrtc.RtcMedia.gen.ts +86 -0
- package/src/plugins/gen/webrtc/sdk/webrtc.RtcPeerConnection.gen.ts +184 -0
- package/src/plugins/gen/webrtc/sdk/webrtc.RtcVideo.gen.ts +48 -0
- package/src/plugins/gen/webrtc/sdk/webrtc.ts +760 -0
- package/src/version.ts +1 -1
package/dist/global.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ declare global {
|
|
|
58
58
|
const Material: typeof SDK.Material
|
|
59
59
|
const MaterialHandle: typeof SDK.MaterialHandle
|
|
60
60
|
const Mathf: typeof SDK.Mathf
|
|
61
|
+
const MediaStream: typeof SDK.MediaStream
|
|
62
|
+
const MediaStreamTrack: typeof SDK.MediaStreamTrack
|
|
61
63
|
const Mesh: typeof SDK.Mesh
|
|
62
64
|
const Model: typeof SDK.Model
|
|
63
65
|
const MouseEnterEvent: typeof SDK.MouseEnterEvent
|
|
@@ -85,6 +87,15 @@ declare global {
|
|
|
85
87
|
const QRScanner: typeof SDK.QRScanner
|
|
86
88
|
const Quat: typeof SDK.Quat
|
|
87
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
|
|
88
99
|
const Ragdoll: typeof SDK.Ragdoll
|
|
89
100
|
const Ray: typeof SDK.Ray
|
|
90
101
|
const Replicated: typeof SDK.Replicated
|
|
@@ -193,6 +204,7 @@ declare global {
|
|
|
193
204
|
const isRawCell: typeof SDK.isRawCell
|
|
194
205
|
const localStorage: typeof SDK.localStorage
|
|
195
206
|
const make: typeof SDK.make
|
|
207
|
+
const mediaDevices: typeof SDK.mediaDevices
|
|
196
208
|
const openFilePicker: typeof SDK.openFilePicker
|
|
197
209
|
const openURL: typeof SDK.openURL
|
|
198
210
|
const packTile: typeof SDK.packTile
|
|
@@ -379,6 +391,9 @@ declare global {
|
|
|
379
391
|
type MaterialDef = SDK.MaterialDef
|
|
380
392
|
type MaterialHandle = SDK.MaterialHandle
|
|
381
393
|
type MaterialParamValue = SDK.MaterialParamValue
|
|
394
|
+
type MediaStream = SDK.MediaStream
|
|
395
|
+
type MediaStreamConstraints = SDK.MediaStreamConstraints
|
|
396
|
+
type MediaStreamTrack = SDK.MediaStreamTrack
|
|
382
397
|
type Mesh = SDK.Mesh
|
|
383
398
|
type MeshDef = SDK.MeshDef
|
|
384
399
|
type Model = SDK.Model
|
|
@@ -436,6 +451,25 @@ declare global {
|
|
|
436
451
|
type PushStatus = SDK.PushStatus
|
|
437
452
|
type QRScanner = SDK.QRScanner
|
|
438
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
|
|
439
473
|
type Ragdoll = SDK.Ragdoll
|
|
440
474
|
type RagdollActivateOptions = SDK.RagdollActivateOptions
|
|
441
475
|
type RagdollDeactivateOptions = SDK.RagdollDeactivateOptions
|
package/dist/types/inject.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from ".
|
|
|
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
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";
|
|
77
78
|
export { Service } from "./plugins/service";
|
|
78
79
|
export { defineScene, use, ref, make, SceneHandle } from "./scene/defineScene";
|
|
79
80
|
export { defineMaterial, MaterialHandle } from "./scene/material";
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import type { Listener, NativeView } from "../../../../plugin";
|
|
2
|
+
import type { AudioConstraints, AudioOutput, DataChannelInit, DataChannelState, DeviceInfo, Encoding, FacingMode, IceCandidate, IceConnectionState, IceGatheringState, IceServer, MediaKind, ObjectFit, OfferOptions, PeerConnectionState, RtcConfiguration, RtcVideoEvents, SdpType, SenderParameters, SessionDescription, SignalingState, TrackSettings, TransceiverDirection, TransceiverInit, VideoConstraints } from "../contract";
|
|
3
|
+
export type { AudioConstraints, AudioOutput, DataChannelInit, DataChannelState, DeviceInfo, Encoding, FacingMode, IceCandidate, IceConnectionState, IceGatheringState, IceServer, MediaKind, ObjectFit, OfferOptions, PeerConnectionState, RtcConfiguration, RtcVideoEvents, SdpType, SenderParameters, SessionDescription, SignalingState, TrackSettings, TransceiverDirection, TransceiverInit, VideoConstraints, };
|
|
4
|
+
/** A listener of one event type; it gets the event, which carries `type` and `target`. */
|
|
5
|
+
export type RTCEventListener<E> = (event: E) => void;
|
|
6
|
+
/** What every object of the API emits from: `addEventListener` / `removeEventListener`, and the
|
|
7
|
+
* `on<type>` properties the subclasses declare. */
|
|
8
|
+
export declare class RTCEventTarget {
|
|
9
|
+
private readonly _listeners;
|
|
10
|
+
addEventListener<E = any>(type: string, listener: RTCEventListener<E>): void;
|
|
11
|
+
removeEventListener<E = any>(type: string, listener: RTCEventListener<E>): void;
|
|
12
|
+
}
|
|
13
|
+
export interface RTCPeerConnectionIceEvent {
|
|
14
|
+
type: "icecandidate";
|
|
15
|
+
candidate: RTCIceCandidate | null;
|
|
16
|
+
target: RTCPeerConnection;
|
|
17
|
+
}
|
|
18
|
+
export interface RTCTrackEvent {
|
|
19
|
+
type: "track";
|
|
20
|
+
track: MediaStreamTrack;
|
|
21
|
+
streams: MediaStream[];
|
|
22
|
+
receiver: RTCRtpReceiver;
|
|
23
|
+
transceiver: RTCRtpTransceiver;
|
|
24
|
+
target: RTCPeerConnection;
|
|
25
|
+
}
|
|
26
|
+
export interface RTCDataChannelEvent {
|
|
27
|
+
type: "datachannel";
|
|
28
|
+
channel: RTCDataChannel;
|
|
29
|
+
target: RTCPeerConnection;
|
|
30
|
+
}
|
|
31
|
+
export interface RTCMessageEvent {
|
|
32
|
+
type: "message";
|
|
33
|
+
data: string | ArrayBuffer;
|
|
34
|
+
target: RTCDataChannel;
|
|
35
|
+
}
|
|
36
|
+
export interface RTCErrorEvent {
|
|
37
|
+
type: "error";
|
|
38
|
+
message: string;
|
|
39
|
+
target: RTCDataChannel;
|
|
40
|
+
}
|
|
41
|
+
export interface RTCEvent<T extends RTCEventTarget = RTCEventTarget> {
|
|
42
|
+
type: string;
|
|
43
|
+
target: T;
|
|
44
|
+
}
|
|
45
|
+
/** One track of audio or video, local (`mediaDevices.getUserMedia`) or received (`pc.ontrack`). */
|
|
46
|
+
export declare class MediaStreamTrack extends RTCEventTarget {
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly kind: MediaKind;
|
|
49
|
+
readonly label: string;
|
|
50
|
+
private _enabled;
|
|
51
|
+
private _muted;
|
|
52
|
+
private _state;
|
|
53
|
+
onended: RTCEventListener<RTCEvent<MediaStreamTrack>> | null;
|
|
54
|
+
onmute: RTCEventListener<RTCEvent<MediaStreamTrack>> | null;
|
|
55
|
+
onunmute: RTCEventListener<RTCEvent<MediaStreamTrack>> | null;
|
|
56
|
+
/** A disabled track sends silence / black frames and stays in every connection. */
|
|
57
|
+
get enabled(): boolean;
|
|
58
|
+
set enabled(value: boolean);
|
|
59
|
+
/** A received track the other side is not sending on. */
|
|
60
|
+
get muted(): boolean;
|
|
61
|
+
get readyState(): "live" | "ended";
|
|
62
|
+
/** End the track: a local one releases its device (once no track of it is left). */
|
|
63
|
+
stop(): void;
|
|
64
|
+
/** Re-aim a local video track: the other camera (`facingMode`), another size or rate. */
|
|
65
|
+
applyConstraints(constraints?: VideoConstraints): Promise<void>;
|
|
66
|
+
/** What a local video track captures with (a promise: the host knows). */
|
|
67
|
+
getSettings(): Promise<TrackSettings>;
|
|
68
|
+
/** The same track object (a track is a handle, not a buffer). */
|
|
69
|
+
clone(): MediaStreamTrack;
|
|
70
|
+
}
|
|
71
|
+
/** A group of tracks: what `getUserMedia` resolves with, what a `track` event names, what
|
|
72
|
+
* `addTrack` associates a track with. The id is a label on the wire. */
|
|
73
|
+
export declare class MediaStream extends RTCEventTarget {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
private readonly _tracks;
|
|
76
|
+
onaddtrack: RTCEventListener<{
|
|
77
|
+
type: "addtrack";
|
|
78
|
+
track: MediaStreamTrack;
|
|
79
|
+
target: MediaStream;
|
|
80
|
+
}> | null;
|
|
81
|
+
onremovetrack: RTCEventListener<{
|
|
82
|
+
type: "removetrack";
|
|
83
|
+
track: MediaStreamTrack;
|
|
84
|
+
target: MediaStream;
|
|
85
|
+
}> | null;
|
|
86
|
+
constructor(tracks?: MediaStreamTrack[] | MediaStream, id?: string);
|
|
87
|
+
/** Whether a track of it is live. */
|
|
88
|
+
get active(): boolean;
|
|
89
|
+
getTracks(): MediaStreamTrack[];
|
|
90
|
+
getAudioTracks(): MediaStreamTrack[];
|
|
91
|
+
getVideoTracks(): MediaStreamTrack[];
|
|
92
|
+
getTrackById(id: string): MediaStreamTrack | null;
|
|
93
|
+
addTrack(track: MediaStreamTrack): void;
|
|
94
|
+
removeTrack(track: MediaStreamTrack): void;
|
|
95
|
+
clone(): MediaStream;
|
|
96
|
+
}
|
|
97
|
+
/** The constraints of `getUserMedia`, the browser's: `true` for the default device, an object to say which. */
|
|
98
|
+
export interface MediaStreamConstraints {
|
|
99
|
+
audio?: boolean | AudioConstraints;
|
|
100
|
+
video?: boolean | VideoConstraints;
|
|
101
|
+
}
|
|
102
|
+
declare class MediaDevices extends RTCEventTarget {
|
|
103
|
+
ondevicechange: RTCEventListener<RTCEvent<MediaDevices>> | null;
|
|
104
|
+
/** Whether this host registered the "rtcMedia" service — the devices. */
|
|
105
|
+
get isSupported(): boolean;
|
|
106
|
+
/** Capture: asks for the permissions it needs, resolves with a stream of the new tracks. Rejects
|
|
107
|
+
* with "denied" / "notFound" / "failed". */
|
|
108
|
+
getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
109
|
+
/** The devices the host can capture with (their labels need a granted permission on the web). */
|
|
110
|
+
enumerateDevices(): Promise<DeviceInfo[]>;
|
|
111
|
+
/** Where the call's audio plays on a phone: the earpiece or the loudspeaker. A no-op on the web. */
|
|
112
|
+
setAudioOutput(output: AudioOutput): Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
/** `navigator.mediaDevices` of the browser: the capture and the device list. Host-optional —
|
|
115
|
+
* `mediaDevices.isSupported` before offering a call. */
|
|
116
|
+
export declare const mediaDevices: MediaDevices;
|
|
117
|
+
/** The browser's RTCSessionDescription: `{ type, sdp }`, as it is signaled. */
|
|
118
|
+
export declare class RTCSessionDescription implements SessionDescription {
|
|
119
|
+
readonly type: SdpType;
|
|
120
|
+
readonly sdp: string;
|
|
121
|
+
constructor(init: SessionDescription);
|
|
122
|
+
toJSON(): SessionDescription;
|
|
123
|
+
}
|
|
124
|
+
/** The browser's RTCIceCandidate: what `icecandidate` carries and `addIceCandidate` takes. */
|
|
125
|
+
export declare class RTCIceCandidate implements IceCandidate {
|
|
126
|
+
readonly candidate: string;
|
|
127
|
+
readonly sdpMid: string | null;
|
|
128
|
+
readonly sdpMLineIndex: number | null;
|
|
129
|
+
readonly usernameFragment: string | undefined;
|
|
130
|
+
constructor(init: RTCIceCandidateInit);
|
|
131
|
+
toJSON(): IceCandidate;
|
|
132
|
+
}
|
|
133
|
+
export interface RTCIceCandidateInit {
|
|
134
|
+
candidate?: string;
|
|
135
|
+
sdpMid?: string | null;
|
|
136
|
+
sdpMLineIndex?: number | null;
|
|
137
|
+
usernameFragment?: string;
|
|
138
|
+
}
|
|
139
|
+
/** The sending half of a transceiver: the track it sends and its encodings. */
|
|
140
|
+
export declare class RTCRtpSender {
|
|
141
|
+
private readonly _pc;
|
|
142
|
+
private _track;
|
|
143
|
+
/** What it sends; null = nothing. */
|
|
144
|
+
get track(): MediaStreamTrack | null;
|
|
145
|
+
/** Swap the track without renegotiating; null = send nothing. */
|
|
146
|
+
replaceTrack(track: MediaStreamTrack | null): Promise<void>;
|
|
147
|
+
/** The encodings (a promise: the host holds them). */
|
|
148
|
+
getParameters(): Promise<SenderParameters>;
|
|
149
|
+
/** The encodings' active / bitrate / scale. */
|
|
150
|
+
setParameters(parameters: SenderParameters): Promise<void>;
|
|
151
|
+
/** The stats of this sender. */
|
|
152
|
+
getStats(): Promise<Map<string, any>>;
|
|
153
|
+
}
|
|
154
|
+
/** The receiving half of a transceiver: its track exists from the start, media arrives into it. */
|
|
155
|
+
export declare class RTCRtpReceiver {
|
|
156
|
+
readonly track: MediaStreamTrack;
|
|
157
|
+
private readonly _pc;
|
|
158
|
+
getStats(): Promise<Map<string, any>>;
|
|
159
|
+
}
|
|
160
|
+
/** One m-line of the session: a sender and a receiver, a direction, a mid once negotiated. */
|
|
161
|
+
export declare class RTCRtpTransceiver {
|
|
162
|
+
readonly sender: RTCRtpSender;
|
|
163
|
+
readonly receiver: RTCRtpReceiver;
|
|
164
|
+
private readonly _pc;
|
|
165
|
+
private _mid;
|
|
166
|
+
private _direction;
|
|
167
|
+
private _currentDirection;
|
|
168
|
+
private _stopped;
|
|
169
|
+
/** The m-line's id once a description named it. */
|
|
170
|
+
get mid(): string | null;
|
|
171
|
+
/** The direction wanted; setting it takes effect at the next negotiation. */
|
|
172
|
+
get direction(): TransceiverDirection;
|
|
173
|
+
set direction(value: TransceiverDirection);
|
|
174
|
+
/** The direction negotiated; null before the first answer. */
|
|
175
|
+
get currentDirection(): TransceiverDirection | null;
|
|
176
|
+
get stopped(): boolean;
|
|
177
|
+
/** Stop sending and receiving on it; the next negotiation removes the m-line. */
|
|
178
|
+
stop(): void;
|
|
179
|
+
}
|
|
180
|
+
/** A data channel: strings and bytes, ordered and reliable unless said otherwise. */
|
|
181
|
+
export declare class RTCDataChannel extends RTCEventTarget {
|
|
182
|
+
readonly label: string;
|
|
183
|
+
readonly ordered: boolean;
|
|
184
|
+
readonly maxPacketLifeTime: number | null;
|
|
185
|
+
readonly maxRetransmits: number | null;
|
|
186
|
+
readonly protocol: string;
|
|
187
|
+
readonly negotiated: boolean;
|
|
188
|
+
/** Bytes arrive as an ArrayBuffer (the browser's "blob" is not a thing here). */
|
|
189
|
+
binaryType: "arraybuffer";
|
|
190
|
+
private readonly _pc;
|
|
191
|
+
private _streamId;
|
|
192
|
+
private _state;
|
|
193
|
+
private _threshold;
|
|
194
|
+
/** What was sent before the host made the channel. */
|
|
195
|
+
private _queue;
|
|
196
|
+
onopen: RTCEventListener<RTCEvent<RTCDataChannel>> | null;
|
|
197
|
+
onclose: RTCEventListener<RTCEvent<RTCDataChannel>> | null;
|
|
198
|
+
onerror: RTCEventListener<RTCErrorEvent> | null;
|
|
199
|
+
onmessage: RTCEventListener<RTCMessageEvent> | null;
|
|
200
|
+
onbufferedamountlow: RTCEventListener<RTCEvent<RTCDataChannel>> | null;
|
|
201
|
+
/** The SCTP stream id; null until the transport assigned one. */
|
|
202
|
+
get id(): number | null;
|
|
203
|
+
get readyState(): DataChannelState;
|
|
204
|
+
/** Bytes queued and not yet sent (a promise: the host counts them). */
|
|
205
|
+
getBufferedAmount(): Promise<number>;
|
|
206
|
+
get bufferedAmountLowThreshold(): number;
|
|
207
|
+
set bufferedAmountLowThreshold(value: number);
|
|
208
|
+
/** Send a string or bytes. Throws when the channel is closing or closed. */
|
|
209
|
+
send(data: string | ArrayBuffer | ArrayBufferView): void;
|
|
210
|
+
private _send;
|
|
211
|
+
close(): void;
|
|
212
|
+
}
|
|
213
|
+
/** `RTCConfiguration` of the browser, with `iceServers[].urls` as one URL or several. */
|
|
214
|
+
export interface RTCConfiguration extends Omit<RtcConfiguration, "iceServers"> {
|
|
215
|
+
iceServers?: {
|
|
216
|
+
urls: string | string[];
|
|
217
|
+
username?: string;
|
|
218
|
+
credential?: string;
|
|
219
|
+
}[];
|
|
220
|
+
}
|
|
221
|
+
/** A connection to one peer: the browser's RTCPeerConnection. The session with the host opens on
|
|
222
|
+
* the first call and closes with `close()`. Signaling — carrying the descriptions and the
|
|
223
|
+
* candidates to the other side — is the app's. */
|
|
224
|
+
export declare class RTCPeerConnection extends RTCEventTarget {
|
|
225
|
+
/** Whether this host registered the "rtcPeerConnection" service. */
|
|
226
|
+
static get isSupported(): boolean;
|
|
227
|
+
private _configuration;
|
|
228
|
+
private _local;
|
|
229
|
+
private _remote;
|
|
230
|
+
private _signaling;
|
|
231
|
+
private _gathering;
|
|
232
|
+
private _ice;
|
|
233
|
+
private _connection;
|
|
234
|
+
private readonly _transceivers;
|
|
235
|
+
private readonly _channels;
|
|
236
|
+
private readonly _remoteTracks;
|
|
237
|
+
/** While a local description is being set, its candidates wait: the browser delivers them
|
|
238
|
+
* after the promise, and the app's signaling expects the description first. */
|
|
239
|
+
private _settingLocal;
|
|
240
|
+
private _heldCandidates;
|
|
241
|
+
onnegotiationneeded: RTCEventListener<RTCEvent<RTCPeerConnection>> | null;
|
|
242
|
+
onicecandidate: RTCEventListener<RTCPeerConnectionIceEvent> | null;
|
|
243
|
+
onsignalingstatechange: RTCEventListener<RTCEvent<RTCPeerConnection>> | null;
|
|
244
|
+
onicegatheringstatechange: RTCEventListener<RTCEvent<RTCPeerConnection>> | null;
|
|
245
|
+
oniceconnectionstatechange: RTCEventListener<RTCEvent<RTCPeerConnection>> | null;
|
|
246
|
+
onconnectionstatechange: RTCEventListener<RTCEvent<RTCPeerConnection>> | null;
|
|
247
|
+
ontrack: RTCEventListener<RTCTrackEvent> | null;
|
|
248
|
+
ondatachannel: RTCEventListener<RTCDataChannelEvent> | null;
|
|
249
|
+
constructor(configuration?: RTCConfiguration);
|
|
250
|
+
get localDescription(): RTCSessionDescription | null;
|
|
251
|
+
get remoteDescription(): RTCSessionDescription | null;
|
|
252
|
+
get currentLocalDescription(): RTCSessionDescription | null;
|
|
253
|
+
get currentRemoteDescription(): RTCSessionDescription | null;
|
|
254
|
+
get signalingState(): SignalingState;
|
|
255
|
+
get iceGatheringState(): IceGatheringState;
|
|
256
|
+
get iceConnectionState(): IceConnectionState;
|
|
257
|
+
get connectionState(): PeerConnectionState;
|
|
258
|
+
createOffer(options?: OfferOptions): Promise<RTCSessionDescription>;
|
|
259
|
+
createAnswer(): Promise<RTCSessionDescription>;
|
|
260
|
+
/** Without a description: the implicit form — an answer to a pending remote offer, an offer
|
|
261
|
+
* otherwise. `localDescription` holds what is in force after. */
|
|
262
|
+
setLocalDescription(description?: SessionDescription | RTCSessionDescription | {
|
|
263
|
+
type: SdpType;
|
|
264
|
+
sdp?: string;
|
|
265
|
+
}): Promise<void>;
|
|
266
|
+
setRemoteDescription(description: SessionDescription | RTCSessionDescription | {
|
|
267
|
+
type: SdpType;
|
|
268
|
+
sdp?: string;
|
|
269
|
+
}): Promise<void>;
|
|
270
|
+
/** A candidate of the other side; none (or an empty one) = the end of its candidates. */
|
|
271
|
+
addIceCandidate(candidate?: RTCIceCandidateInit | RTCIceCandidate | null): Promise<void>;
|
|
272
|
+
/** The next offer carries new ICE credentials. */
|
|
273
|
+
restartIce(): void;
|
|
274
|
+
getConfiguration(): RTCConfiguration;
|
|
275
|
+
setConfiguration(configuration: RTCConfiguration): Promise<void>;
|
|
276
|
+
/** Send a local track, in the streams named (the browser's `addTrack(track, ...streams)`). The
|
|
277
|
+
* sender is known once the host made it: a promise, where the browser answers at once. */
|
|
278
|
+
addTrack(track: MediaStreamTrack, ...streams: MediaStream[]): Promise<RTCRtpSender>;
|
|
279
|
+
removeTrack(sender: RTCRtpSender): Promise<void>;
|
|
280
|
+
/** Add an m-line: for a kind, or for a track to send on it. A promise, where the browser answers at once. */
|
|
281
|
+
addTransceiver(trackOrKind: MediaStreamTrack | MediaKind, init?: Omit<TransceiverInit, "trackId" | "streamIds"> & {
|
|
282
|
+
streams?: MediaStream[];
|
|
283
|
+
}): Promise<RTCRtpTransceiver>;
|
|
284
|
+
/** The transceivers as last synced (after every description, on every `track` event). */
|
|
285
|
+
getTransceivers(): RTCRtpTransceiver[];
|
|
286
|
+
getSenders(): RTCRtpSender[];
|
|
287
|
+
getReceivers(): RTCRtpReceiver[];
|
|
288
|
+
/** The RTCStatsReport: a Map of the stats id → the stats object (`type`, `timestamp` in ms, the
|
|
289
|
+
* fields of its type), for the whole connection or one track's senders / receivers. */
|
|
290
|
+
getStats(selector?: MediaStreamTrack | null): Promise<Map<string, any>>;
|
|
291
|
+
/** Open a data channel. The channel is "connecting" until the host and the other side are ready;
|
|
292
|
+
* what is sent before counts as queued. */
|
|
293
|
+
createDataChannel(label: string, init?: DataChannelInit): RTCDataChannel;
|
|
294
|
+
/** Close the connection: the session with the host ends, every received track ends, every
|
|
295
|
+
* channel closes. */
|
|
296
|
+
close(): void;
|
|
297
|
+
private _transceiverOf;
|
|
298
|
+
private _syncTransceivers;
|
|
299
|
+
private _onTrack;
|
|
300
|
+
}
|
|
301
|
+
export interface RTCVideoViewOptions {
|
|
302
|
+
/** The track to draw; none = black. */
|
|
303
|
+
track?: MediaStreamTrack | null;
|
|
304
|
+
/** Default "cover". */
|
|
305
|
+
objectFit?: ObjectFit;
|
|
306
|
+
/** Flip horizontally — the front camera's preview. Default false. */
|
|
307
|
+
mirror?: boolean;
|
|
308
|
+
}
|
|
309
|
+
/** A tree node that draws one video track: embed it among a screen's children (sized by its
|
|
310
|
+
* styles) or present it fullscreen (`open()`). `track` may change at any time. */
|
|
311
|
+
export interface RTCVideoView extends NativeView {
|
|
312
|
+
/** The track drawn; null = black. */
|
|
313
|
+
track: MediaStreamTrack | null;
|
|
314
|
+
objectFit: ObjectFit;
|
|
315
|
+
mirror: boolean;
|
|
316
|
+
/** `resize`: the first frame, and every change of the picture's size. */
|
|
317
|
+
on<K extends keyof RtcVideoEvents & string>(event: K, callback: Listener<RtcVideoEvents, K>): this;
|
|
318
|
+
off<K extends keyof RtcVideoEvents & string>(event: K, callback: Listener<RtcVideoEvents, K>): this;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Create a video view. `RTCVideoView.isSupported` reports whether this host has the capability —
|
|
322
|
+
* check it before offering the feature (a view no host registered mounts nothing).
|
|
323
|
+
*/
|
|
324
|
+
export declare const RTCVideoView: {
|
|
325
|
+
(options?: RTCVideoViewOptions): RTCVideoView;
|
|
326
|
+
/** Whether this host registered an "rtcVideo" view. */
|
|
327
|
+
readonly isSupported: boolean;
|
|
328
|
+
};
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.2.
|
|
1
|
+
export declare const SDK_VERSION = "2.2.8";
|
|
2
2
|
/** The major of a semver string, or null when it is not one. */
|
|
3
3
|
export declare const sdkMajor: (version: string | null | undefined) => number | null;
|
|
4
4
|
/** The `// sdk: <version>` line of a compiled bundle's header (sdk/src/compile/header.ts), read from
|