@fishjam-cloud/ts-client 0.25.3 → 0.26.0-rc.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.
- package/dist/index.d.mts +45 -7
- package/dist/index.mjs +1 -1
- package/dist/index.react-native.mjs +3 -3
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import TypedEmitter from 'typed-emitter';
|
|
|
4
4
|
declare const AUTH_ERROR_REASONS: readonly ["missing token", "invalid token", "expired token", "room not found", "peer not found"];
|
|
5
5
|
type AuthErrorReason = (typeof AUTH_ERROR_REASONS)[number];
|
|
6
6
|
declare const isAuthError: (error: string) => error is AuthErrorReason;
|
|
7
|
+
declare const normalizeCloseReason: (reason: string) => string;
|
|
7
8
|
|
|
8
9
|
declare class TrackTypeError extends Error {
|
|
9
10
|
constructor();
|
|
@@ -603,6 +604,24 @@ declare class WebRTCEndpoint extends WebRTCEndpoint_base {
|
|
|
603
604
|
* ```
|
|
604
605
|
*/
|
|
605
606
|
connect: (metadata: unknown) => void;
|
|
607
|
+
/**
|
|
608
|
+
* Returns the current audio level for a local audio track, if available.
|
|
609
|
+
*
|
|
610
|
+
* This method only works for local **audio** tracks that have been negotiated
|
|
611
|
+
* with the remote peer and for which an underlying `RTCRtpSender` and
|
|
612
|
+
* statistics are available.
|
|
613
|
+
*
|
|
614
|
+
* @param trackId - Identifier of the local track to query, as used when
|
|
615
|
+
* adding or managing local tracks on this endpoint.
|
|
616
|
+
* @returns A promise that resolves to `{ level: number }` when an audio
|
|
617
|
+
* level can be determined for the given track, or `null` if:
|
|
618
|
+
* - the track does not exist,
|
|
619
|
+
* - the track is not an audio track,
|
|
620
|
+
* - the track has not yet been negotiated / no sender exists
|
|
621
|
+
*/
|
|
622
|
+
getLocalTrackAudioLevel(trackId: string): Promise<{
|
|
623
|
+
level: number;
|
|
624
|
+
} | null>;
|
|
606
625
|
/**
|
|
607
626
|
* Feeds media event received from RTC Engine to {@link WebRTCEndpoint}.
|
|
608
627
|
* This function should be called whenever some media event from RTC Engine
|
|
@@ -655,10 +674,8 @@ declare class WebRTCEndpoint extends WebRTCEndpoint_base {
|
|
|
655
674
|
* @param trackMetadata - Any information about this track that other endpoints will
|
|
656
675
|
* receive in {@link WebRTCEndpointEvents.endpointAdded}. E.g. this can source of the track - whether it's
|
|
657
676
|
* screensharing, webcam or some other media device.
|
|
658
|
-
* @param
|
|
659
|
-
*
|
|
660
|
-
* manual track selection support is added. For more information refer to {@link SimulcastConfig}.
|
|
661
|
-
* @param _maxBandwidth - maximal bandwidth this track can use. **Currently processed with a threshold check**:
|
|
677
|
+
* @param simulcastConfig - Simulcast configuration. For more information refer to {@link SimulcastConfig}.
|
|
678
|
+
* @param maxBandwidth - maximal bandwidth this track can use. **Currently processed with a threshold check**:
|
|
662
679
|
* if the value is a positive number, it will be used; otherwise, it defaults to 0 (unlimited).
|
|
663
680
|
* This option has no effect for simulcast and audio tracks.
|
|
664
681
|
* For simulcast tracks use `{@link WebRTCEndpoint.setTrackBandwidth}.
|
|
@@ -693,7 +710,7 @@ declare class WebRTCEndpoint extends WebRTCEndpoint_base {
|
|
|
693
710
|
* .forEach((track) => webrtc.addTrack(track, localStream));
|
|
694
711
|
* ```
|
|
695
712
|
*/
|
|
696
|
-
addTrack(track: MediaStreamTrack, trackMetadata?: unknown,
|
|
713
|
+
addTrack(track: MediaStreamTrack, trackMetadata?: unknown, simulcastConfig?: MediaEvent_Track_SimulcastConfig, maxBandwidth?: TrackBandwidthLimit, stream?: MediaStream): Promise<string>;
|
|
697
714
|
/**
|
|
698
715
|
* Replaces a track that is being sent to the RTC Engine.
|
|
699
716
|
* @param trackId - Audio or video track.
|
|
@@ -916,7 +933,7 @@ declare class WebRTCEndpoint extends WebRTCEndpoint_base {
|
|
|
916
933
|
private onIceConnectionStateChange;
|
|
917
934
|
}
|
|
918
935
|
|
|
919
|
-
declare const JOIN_ERRORS: readonly ["reached peers limit", "room not found", "node not found", "
|
|
936
|
+
declare const JOIN_ERRORS: readonly ["reached peers limit", "room not found", "node not found", "invalid sdk version"];
|
|
920
937
|
type JoinErrorReason = (typeof JOIN_ERRORS)[number];
|
|
921
938
|
declare const isJoinError: (error: string) => error is JoinErrorReason;
|
|
922
939
|
|
|
@@ -1094,6 +1111,7 @@ type MessageEvents<P, S> = {
|
|
|
1094
1111
|
* by the server. It's measured in bits per second.
|
|
1095
1112
|
*/
|
|
1096
1113
|
bandwidthEstimationChanged: (estimation: bigint) => void;
|
|
1114
|
+
encodingChanged: TrackContextEvents['encodingChanged'];
|
|
1097
1115
|
targetTrackEncodingRequested: (event: Parameters<WebRTCEndpointEvents['targetTrackEncodingRequested']>[0]) => void;
|
|
1098
1116
|
localTrackAdded: (event: Parameters<WebRTCEndpointEvents['localTrackAdded']>[0]) => void;
|
|
1099
1117
|
localTrackRemoved: (event: Parameters<WebRTCEndpointEvents['localTrackRemoved']>[0]) => void;
|
|
@@ -1190,6 +1208,9 @@ declare class FishjamClient<PeerMetadata = GenericMetadata, ServerMetadata = Gen
|
|
|
1190
1208
|
private reconnectManager;
|
|
1191
1209
|
private peerMessageQueue;
|
|
1192
1210
|
private sendStatisticsInterval;
|
|
1211
|
+
private cameraStream;
|
|
1212
|
+
private screenShareStream;
|
|
1213
|
+
private trackIdToTrack;
|
|
1193
1214
|
constructor(config?: CreateConfig);
|
|
1194
1215
|
/**
|
|
1195
1216
|
* Uses the WebSocket connection and {@link !WebRTCEndpoint | WebRTCEndpoint} to join to the room. Registers the callbacks to
|
|
@@ -1572,6 +1593,23 @@ declare class FishjamClient<PeerMetadata = GenericMetadata, ServerMetadata = Gen
|
|
|
1572
1593
|
*/
|
|
1573
1594
|
disconnect(): void;
|
|
1574
1595
|
cleanup(): void;
|
|
1596
|
+
/**
|
|
1597
|
+
* Returns the current audio level for a local track.
|
|
1598
|
+
*
|
|
1599
|
+
* The `level` represents a normalized audio level in the range 0.0–1.0,
|
|
1600
|
+
* derived from WebRTC statistics for the given local audio track.
|
|
1601
|
+
*
|
|
1602
|
+
* This method returns `null` when the WebRTC layer is not initialized, when the track
|
|
1603
|
+
* cannot be found among local tracks, or when audio statistics are not yet or no longer
|
|
1604
|
+
* available for the track.
|
|
1605
|
+
*
|
|
1606
|
+
* @param trackId - The ID of the local track to query.
|
|
1607
|
+
* @returns A promise resolving to an object containing the audio `level`, or `null`
|
|
1608
|
+
* if the track is unknown or stats are not available.
|
|
1609
|
+
*/
|
|
1610
|
+
getLocalTrackAudioLevel(trackId: string): Promise<{
|
|
1611
|
+
level: number;
|
|
1612
|
+
} | null>;
|
|
1575
1613
|
}
|
|
1576
1614
|
|
|
1577
1615
|
type ReceiveLivestreamResult = {
|
|
@@ -1595,4 +1633,4 @@ type LivestreamCallbacks = {
|
|
|
1595
1633
|
declare function receiveLivestream(url: string, token?: string, callbacks?: LivestreamCallbacks): Promise<ReceiveLivestreamResult>;
|
|
1596
1634
|
declare function publishLivestream(stream: MediaStream, url: string, token: string, callbacks?: LivestreamCallbacks): Promise<PublishLivestreamResult>;
|
|
1597
1635
|
|
|
1598
|
-
export { AUTH_ERROR_REASONS, type AuthErrorReason, type BandwidthLimit, type ClientType, type Component, type ConnectConfig, type CreateConfig, type DataCallback, type DataChannelMessagePayload, type DataChannelOptions, type DataChannelType, type EncodingReason, type Endpoint, FishjamClient, type FishjamTrackContext, type GenericMetadata, JOIN_ERRORS, type JoinErrorReason, type LivestreamCallbacks, LivestreamError, type Logger, type MediaEvent, type MessageEvents, type Metadata, type Peer, type PublishLivestreamResult, type ReceiveLivestreamResult, type ReconnectConfig, type ReconnectionStatus, type SerializedMediaEvent, type SimulcastBandwidthLimit, MediaEvent_Track_SimulcastConfig as SimulcastConfig, type TrackBandwidthLimit, type TrackContext, type TrackContextEvents, type TrackKind, type TrackMetadata, TrackTypeError, type VadStatus, Variant, WebRTCEndpoint, type WebRTCEndpointEvents, getLogger, isAuthError, isJoinError, publishLivestream, receiveLivestream };
|
|
1636
|
+
export { AUTH_ERROR_REASONS, type AuthErrorReason, type BandwidthLimit, type ClientType, type Component, type ConnectConfig, type CreateConfig, type DataCallback, type DataChannelMessagePayload, type DataChannelOptions, type DataChannelType, type EncodingReason, type Endpoint, FishjamClient, type FishjamTrackContext, type GenericMetadata, JOIN_ERRORS, type JoinErrorReason, type LivestreamCallbacks, LivestreamError, type Logger, type MediaEvent, type MessageEvents, type Metadata, type Peer, type PublishLivestreamResult, type ReceiveLivestreamResult, type ReconnectConfig, type ReconnectionStatus, type SerializedMediaEvent, type SimulcastBandwidthLimit, MediaEvent_Track_SimulcastConfig as SimulcastConfig, type TrackBandwidthLimit, type TrackContext, type TrackContextEvents, type TrackKind, type TrackMetadata, TrackTypeError, type VadStatus, Variant, WebRTCEndpoint, type WebRTCEndpointEvents, getLogger, isAuthError, isJoinError, normalizeCloseReason, publishLivestream, receiveLivestream };
|