amazon-ivs-web-broadcast
Advanced tools
Comparing version 1.6.1-rc.0 to 1.7.0
@@ -7,4 +7,4 @@ import { MediaStreamManager } from '../client-common/media-stream-manager'; | ||
source: MediaStream; | ||
audioTrackSource?: MediaStreamAudioSourceNode; | ||
gainNode?: GainNode; | ||
audioTrackSource: MediaStreamAudioSourceNode; | ||
gainNode: GainNode; | ||
} | ||
@@ -315,9 +315,2 @@ /** | ||
private shouldMix; | ||
/** | ||
* Processes an audio input name | ||
* | ||
* @param name - The provided name input | ||
* @returns - The processed output | ||
*/ | ||
private processAudioInputName; | ||
} | ||
@@ -324,0 +317,0 @@ /** |
@@ -191,4 +191,3 @@ import { Logger, LogLevels } from '../client-common/logger/logger.types'; | ||
set networkReconnectConfig(newNetworkReconnectConfig: NetworkReconnectConfig | undefined); | ||
get isAudioMixingDisabled(): boolean; | ||
} | ||
export declare function createConfigFromBroadcastConfig(broadcastConfig: BroadcastClientConfig): Config; |
@@ -34,5 +34,2 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
private analyticsTracker; | ||
private removeTrackChangeListener?; | ||
private videoSender?; | ||
private audioSender?; | ||
/** | ||
@@ -74,3 +71,2 @@ * Creates an instance of the [[PeerClient]]. | ||
getConnectionState: () => ConnectionState; | ||
private addOrReplaceVideoTrack; | ||
/** | ||
@@ -82,4 +78,5 @@ * Iterates over the array of provided MediaStreamTracks and adds them to the peer connection. | ||
*/ | ||
private addOrReplaceAudioTrack; | ||
private onTrackChange; | ||
addTracks(data: { | ||
tracks: MediaStreamTrack[]; | ||
}): void; | ||
/** | ||
@@ -86,0 +83,0 @@ * Gets the list of reports from the RTCStatsReport array. |
import { StageClientError } from '../../stage/core-api/errors'; | ||
import { SfuResource } from '../types'; | ||
import { type SpadeEvent, AnalyticsEvent } from './events/base-analytics.types'; | ||
@@ -79,4 +78,2 @@ /** | ||
private init; | ||
setSfuResource(sfuResource: SfuResource | undefined): void; | ||
getSfuResource(): SfuResource | undefined; | ||
/** | ||
@@ -83,0 +80,0 @@ * Generates a random UUIDv4 string to be used as a GUID. |
@@ -6,11 +6,8 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
import { Maybe } from './types'; | ||
export declare type SetTrackListener = (type: TrackType, track: MediaStreamTrack) => void; | ||
export declare class MediaStreamManager { | ||
private static msmMap; | ||
private mediaTracks; | ||
private trackChangeListeners; | ||
static getOrRegisterInstance(context: Stage | AmazonIVSBroadcastClient): MediaStreamManager; | ||
setTrack(type: TrackType, track: MediaStreamTrack): void; | ||
getTrack(type: TrackType): Maybe<MediaStreamTrack>; | ||
addTrackChangeListener(callback: SetTrackListener): () => void; | ||
} |
@@ -13,3 +13,6 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
getConnectionState(): ConnectionState; | ||
addTracks(data: { | ||
tracks: MediaStreamTrack[]; | ||
}): void; | ||
getReports(): Report[]; | ||
} |
@@ -18,7 +18,17 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
}>; | ||
/** @internal */ | ||
export declare type WHIPServerResponse = { | ||
url: string; | ||
sdpAnswer: string; | ||
location?: string; | ||
sessionDeleteLink?: string; | ||
mediaControls?: string; | ||
}; | ||
/** @internal */ | ||
export declare type WHIPResource = { | ||
path?: string; | ||
sessionDelete?: string; | ||
location?: string; | ||
sessionDeleteLink?: string; | ||
mediaControls?: string; | ||
}; | ||
/** @internal */ | ||
export declare type SfuResource = { | ||
@@ -28,3 +38,4 @@ node: string; | ||
}; | ||
/** @internal */ | ||
export declare type ValuesOf<T> = T[keyof T]; | ||
export declare type Maybe<T> = T | undefined; |
@@ -5,2 +5,1 @@ /** | ||
export declare const isSupported: () => boolean; | ||
export declare function isIos(): boolean; |
/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
import { StageAnalyticsEvent } from '../../stage/core-api/analytics/event'; | ||
import { TraceId } from '../../stage/core-api/analytics/random.uuid'; | ||
import { StageToken } from '../../stage/core-api/token'; | ||
interface GuestStarTokenAttributes { | ||
gs_role?: string; | ||
gs_session_id?: string; | ||
} | ||
import { ClaimsAttributes, ClaimsCapabilities, StageToken } from '../../stage/core-api/token'; | ||
/** | ||
@@ -21,3 +17,3 @@ * Creates test stage token. | ||
*/ | ||
declare function makeTestToken({ stageArn, participantId, eventsURL, whipURL, userID, expirationTime, topic, attributes, }: { | ||
declare function makeTestToken({ stageArn, participantId, eventsURL, whipURL, userID, expirationTime, topic, attributes, capabilities, }: { | ||
stageArn: string; | ||
@@ -30,3 +26,4 @@ participantId: string; | ||
topic?: string; | ||
attributes?: GuestStarTokenAttributes; | ||
attributes?: ClaimsAttributes; | ||
capabilities?: ClaimsCapabilities; | ||
}): string; | ||
@@ -33,0 +30,0 @@ /** |
@@ -19,5 +19,7 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
PUBLISH_STARTED = "ivs_broadcast_multihost_publish_started", | ||
PUBLISH_FAILED = "ivs_broadcast_multihost_publish_failed", | ||
PUBLISH_ENDED = "ivs_broadcast_multihost_publish_ended", | ||
STATE_UPDATED = "ivs_broadcast_multihost_event_state_updated", | ||
SUBSCRIBE_STARTED = "ivs_broadcast_multihost_subscribe_started", | ||
SUBSCRIBE_FAILED = "ivs_broadcast_multihost_subscribe_failed", | ||
SUBSCRIBE_ENDED = "ivs_broadcast_multihost_subscribe_ended", | ||
@@ -24,0 +26,0 @@ JOIN = "ivs_broadcast_multihost_join", |
@@ -0,1 +1,3 @@ | ||
/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
import { SfuResource } from '../../../client-common/types'; | ||
import { type StageToken } from '../token'; | ||
@@ -39,4 +41,23 @@ import { StageAnalyticsEvent } from './event'; | ||
totalDuration: number; | ||
edpInitialConnectDuration: number; | ||
edpInitialConnectAttempts: number; | ||
edpInitialStateDuration: number; | ||
edpStateUpdateCount: number; | ||
sdpExchangeDuration: number; | ||
sdpExchangeTransport: string; | ||
setRemoteDescDuration: number; | ||
peerConnectionDuration: number; | ||
sfuResource?: SfuResource; | ||
}); | ||
} | ||
export declare class PublishFailedEvent extends StageAnalyticsEvent { | ||
constructor(properties: { | ||
token: StageToken; | ||
traceId: TraceId; | ||
code: number; | ||
message: string; | ||
fatal: boolean; | ||
nominal: boolean; | ||
}); | ||
} | ||
export declare class PublishEndedEvent extends StageAnalyticsEvent { | ||
@@ -59,4 +80,25 @@ constructor(properties: { | ||
totalDuration: number; | ||
edpInitialConnectDuration: number; | ||
edpInitialConnectAttempts: number; | ||
edpInitialStateDuration: number; | ||
edpInitialStatePublishingCount: number; | ||
edpStateUpdateCount: number; | ||
sdpExchangeDuration: number; | ||
sdpExchangeTransport: string; | ||
setRemoteDescDuration: number; | ||
peerConnectionDuration: number; | ||
sfuResource?: SfuResource; | ||
}); | ||
} | ||
export declare class SubscribeFailedEvent extends StageAnalyticsEvent { | ||
constructor(properties: { | ||
token: StageToken; | ||
traceId: TraceId; | ||
remoteParticipantId: string; | ||
code: number; | ||
message: string; | ||
fatal: boolean; | ||
nominal: boolean; | ||
}); | ||
} | ||
export declare class SubscribeEndedEvent extends StageAnalyticsEvent { | ||
@@ -63,0 +105,0 @@ constructor(properties: { |
@@ -7,5 +7,5 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
declare class ServerRequestEvent extends StageAnalyticsEvent { | ||
constructor(action: Action, token: StageToken, url: string, httpMethod: string, requestUuid: string, remoteParticipantId: string, traceId: TraceId); | ||
constructor(action: Action, token: StageToken, url: string, httpMethod: string, requestUuid: string, remoteParticipantId: string, traceId: TraceId, transport: string); | ||
} | ||
declare const headerXStagesWhipVersionValue = "draft-ietf-wish-whip-04"; | ||
export { headerXStagesWhipVersionValue, ServerRequestEvent }; |
@@ -0,1 +1,3 @@ | ||
/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
import { SfuResource } from '../../../client-common/types'; | ||
import { StageToken } from '../token'; | ||
@@ -15,6 +17,6 @@ import { StageAnalyticsEvent } from './event'; | ||
*/ | ||
constructor(token: StageToken, traceId: TraceId, stats: RTCOutboundRtpStreamStats); | ||
constructor(token: StageToken, traceId: TraceId, sfuResource: SfuResource, stats: RTCOutboundRtpStreamStats); | ||
} | ||
export declare class PublishedVideoStatsWindowEvent extends StageAnalyticsEvent { | ||
constructor(token: StageToken, traceId: TraceId, curStats: RTCOutboundRtpStreamStats, prevStats: RTCOutboundRtpStreamStats); | ||
constructor(token: StageToken, traceId: TraceId, sfuResource: SfuResource, curStats: RTCOutboundRtpStreamStats, prevStats: RTCOutboundRtpStreamStats); | ||
} | ||
@@ -32,6 +34,6 @@ /** | ||
*/ | ||
constructor(token: StageToken, traceId: TraceId, stats: RTCOutboundRtpStreamStats); | ||
constructor(token: StageToken, traceId: TraceId, sfuResource: SfuResource, stats: RTCOutboundRtpStreamStats); | ||
} | ||
export declare class PublishedAudioStatsWindowEvent extends StageAnalyticsEvent { | ||
constructor(token: StageToken, traceId: TraceId, curStats: RTCOutboundRtpStreamStats, prevStats: RTCOutboundRtpStreamStats); | ||
constructor(token: StageToken, traceId: TraceId, sfuResource: SfuResource, curStats: RTCOutboundRtpStreamStats, prevStats: RTCOutboundRtpStreamStats); | ||
} | ||
@@ -50,3 +52,3 @@ /** | ||
*/ | ||
constructor(token: StageToken, traceId: TraceId, remoteParticipantID: string, stats: RTCInboundRtpStreamStats); | ||
constructor(token: StageToken, traceId: TraceId, remoteParticipantID: string, sfuResource: SfuResource, stats: RTCInboundRtpStreamStats); | ||
} | ||
@@ -62,3 +64,3 @@ export declare class SubscribedVideoStatsWindowEvent extends StageAnalyticsEvent { | ||
*/ | ||
constructor(token: StageToken, traceId: TraceId, remoteParticipantID: string, curStats: RTCInboundRtpStreamStats, prevStats: RTCInboundRtpStreamStats); | ||
constructor(token: StageToken, traceId: TraceId, remoteParticipantID: string, sfuResource: SfuResource, curStats: RTCInboundRtpStreamStats, prevStats: RTCInboundRtpStreamStats); | ||
} | ||
@@ -77,3 +79,3 @@ /** | ||
*/ | ||
constructor(token: StageToken, traceId: TraceId, remoteParticipantID: string, stats: RTCInboundRtpStreamStats); | ||
constructor(token: StageToken, traceId: TraceId, remoteParticipantID: string, sfuResource: SfuResource, stats: RTCInboundRtpStreamStats); | ||
} | ||
@@ -89,3 +91,3 @@ export declare class SubscribedAudioStatsWindowEvent extends StageAnalyticsEvent { | ||
*/ | ||
constructor(token: StageToken, traceId: TraceId, remoteParticipantID: string, curStats: RTCInboundRtpStreamStats, prevStats: RTCInboundRtpStreamStats); | ||
constructor(token: StageToken, traceId: TraceId, remoteParticipantID: string, sfuResource: SfuResource, curStats: RTCInboundRtpStreamStats, prevStats: RTCInboundRtpStreamStats); | ||
} |
@@ -15,4 +15,4 @@ import { BroadcastClientError } from '../../../client-common/errors'; | ||
requestUUID?: RequestUUID; | ||
nominal?: boolean; | ||
fatal?: boolean; | ||
nominal: boolean; | ||
fatal: boolean; | ||
} | ||
@@ -32,4 +32,4 @@ /** | ||
requestUUID?: RequestUUID; | ||
fatal?: boolean; | ||
nominal?: boolean; | ||
fatal: boolean; | ||
nominal: boolean; | ||
/** | ||
@@ -71,2 +71,38 @@ * Creates the new error. | ||
export declare function convertToStageErrorProps(error: unknown, defaultError: StageErrorValue): StageErrorValue; | ||
export declare function toStageErrorProps(httpStatus: number, errorCode: number): { | ||
readonly code: 1001; | ||
readonly message: "Token expired and is no longer valid"; | ||
readonly fatal: true; | ||
readonly nominal: true; | ||
} | { | ||
readonly code: 1024; | ||
readonly message: "Stage at capacity"; | ||
readonly fatal: true; | ||
readonly nominal: false; | ||
} | { | ||
readonly code: 1025; | ||
readonly message: "Internal server error"; | ||
readonly fatal: true; | ||
readonly nominal: false; | ||
} | { | ||
readonly code: 1026; | ||
readonly message: "Token permissions are not valid for the operation"; | ||
readonly fatal: true; | ||
readonly nominal: false; | ||
} | { | ||
readonly code: 1099; | ||
readonly message: "Service error code unknown or not found"; | ||
readonly fatal: true; | ||
readonly nominal: false; | ||
} | { | ||
readonly code: 1206; | ||
readonly message: "WHIP signaling session resource not found"; | ||
readonly fatal: true; | ||
readonly nominal: true; | ||
} | { | ||
readonly code: 1207; | ||
readonly message: "WHIP endpoint received too many requests"; | ||
readonly fatal: false; | ||
readonly nominal: false; | ||
} | undefined; | ||
export declare enum MERCURY_ERRORS { | ||
@@ -162,3 +198,3 @@ Unspecified = 2001, | ||
}; | ||
readonly UNKNOWN_PERMISSIONS_ERROR: { | ||
readonly UNKNOWN_SERVER_ERROR: { | ||
readonly code: 1099; | ||
@@ -169,2 +205,26 @@ readonly message: "Service error code unknown or not found"; | ||
}; | ||
readonly XDP_CONNECTION_LOST: { | ||
readonly code: 1221; | ||
readonly message: "Connection lost during SDP exchange"; | ||
readonly fatal: false; | ||
readonly nominal: false; | ||
}; | ||
readonly XDP_INVALID_ANSWER_MSG: { | ||
readonly code: 1222; | ||
readonly message: "Invalid answer message received by client"; | ||
readonly fatal: false; | ||
readonly nominal: false; | ||
}; | ||
readonly XDP_TIMEOUT: { | ||
readonly code: 1223; | ||
readonly message: "Failed to receive SDP answer within timeout period"; | ||
readonly fatal: false; | ||
readonly nominal: false; | ||
}; | ||
readonly XDP_UNEXPECTED_ERROR: { | ||
readonly code: 1224; | ||
readonly message: "Unexpected error encountered"; | ||
readonly fatal: false; | ||
readonly nominal: false; | ||
}; | ||
/** | ||
@@ -224,2 +284,8 @@ * Signaling session (WHIP exchange + websocket) related errors. (1200 - 1299) | ||
}; | ||
readonly EVENT_PLANE_NOT_CONNECTED: { | ||
readonly code: 1302; | ||
readonly message: "Unexpectantly not connected to event plane"; | ||
readonly fatal: false; | ||
readonly nominal: false; | ||
}; | ||
/** | ||
@@ -252,2 +318,8 @@ * Peer Connection related errors. (1400 - 1499) | ||
}; | ||
readonly SET_ANSWER_FAILURE: { | ||
readonly code: 1405; | ||
readonly message: "Failed to set remote answer"; | ||
readonly fatal: false; | ||
readonly nominal: false; | ||
}; | ||
}; | ||
@@ -254,0 +326,0 @@ export declare enum STAGE_PUBSUB_ENDED_REASON { |
@@ -10,2 +10,6 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
private timeToConnected; | ||
private sdpExchangeDuration; | ||
private sdpExchangeTransport; | ||
private setRemoteDescDuration; | ||
private peerConnectionDuration; | ||
private action; | ||
@@ -22,2 +26,7 @@ private traceId; | ||
markActionStop(): void; | ||
markSetRemoteDescStart(): void; | ||
markSetRemoteDescStop(): void; | ||
markSdpExchangeStart(): void; | ||
markSdpExchangeStop(): void; | ||
setTransport(transport: string): void; | ||
private markStart; | ||
@@ -32,3 +41,8 @@ private markStop; | ||
timeToConnected: number; | ||
sdpExchangeDuration: number; | ||
sdpExchangeTransport: string; | ||
setRemoteDescDuration: number; | ||
peerConnectionDuration: number; | ||
}; | ||
resetMeasurements(): void; | ||
} |
@@ -0,1 +1,2 @@ | ||
import { SfuResource } from '../../client-common/types'; | ||
import { TraceId } from './analytics/random.uuid'; | ||
@@ -24,2 +25,3 @@ import { type StageToken } from './token'; | ||
private prevVideoStats; | ||
private sfuResource; | ||
constructor(action: Action, token: StageToken, traceId: TraceId, identifier: string); | ||
@@ -29,2 +31,3 @@ private static defaultMultihostConfiguration; | ||
stop(): void; | ||
updateSfuResource(sfuResource: SfuResource): void; | ||
updateMultihostConfiguration(audioTrack: AudioTrackWithConfig | undefined, videoTrack: VideoTrackWithConfig | undefined): Promise<void>; | ||
@@ -31,0 +34,0 @@ private onPeerConnectionStateChange; |
@@ -0,1 +1,2 @@ | ||
import { SfuResource } from '../../client-common/types'; | ||
import { ConnectionState, PeerClientEventPayloads } from '../../client-common/broadcast-client-events'; | ||
@@ -8,2 +9,3 @@ import { Logger } from '../../client-common/logger'; | ||
import { TrackWithConfig } from './stage-publication'; | ||
import { StageConnection } from './stage-connection'; | ||
/** | ||
@@ -19,2 +21,3 @@ * A utility class wrapping the RTCPeerConnection instantiation and lifecycle management. | ||
private whipResource?; | ||
private sfuResource; | ||
private token; | ||
@@ -36,2 +39,3 @@ private analyticsTracker; | ||
private stageCapabilities; | ||
private sdpExchangers; | ||
/** | ||
@@ -45,3 +49,3 @@ * Creates an instance of the [[PeerClient]].s | ||
*/ | ||
constructor(token: StageToken, logger: Logger, action: Action, tag: string, traceId: TraceId, subscriberId?: string); | ||
constructor(token: StageToken, logger: Logger, action: Action, tag: string, traceId: TraceId, subscriberId?: string, stageConnection?: StageConnection); | ||
connect: (audioOnly: boolean | undefined, traceId: TraceId) => Promise<{ | ||
@@ -52,2 +56,10 @@ mediaStream: MediaStream | null; | ||
/** | ||
* Returns an array of SdpExchangers ordered by which should be attempted | ||
* first if supported | ||
* | ||
* @param stageConnection - Stage connection | ||
* @returns - Ordered array of sdp exchangers | ||
*/ | ||
private createSdpExchangers; | ||
/** | ||
* Verifies that we are currently publishing the correct MediaStreamTracks. If we are not | ||
@@ -86,2 +98,18 @@ * it wil update the transceivers so that they are publishing the correct tracks. This is a | ||
/** | ||
* Munge the local offer's SDP. | ||
* | ||
* @param sdp - The sdp generated by the peer connection's createOffer function | ||
* @param action - The Action for this peer-client | ||
* @param options - The options to factor into the munging. | ||
* @returns - The original sdp OR the a munged SDP depending on the arguments provided. | ||
*/ | ||
private mungeSdpOffer; | ||
/** | ||
* Munge the SDP returned by the WHIP server. | ||
* | ||
* @param sdp - The remote SDP returned by the WHIP server | ||
* @returns - A potentially munged SDP | ||
*/ | ||
private mungeSdpAnswer; | ||
/** | ||
* Terminates the WebRTC IVS connection and does a clean up of the RTCPeerConnection. | ||
@@ -170,2 +198,6 @@ */ | ||
timeToConnected: number; | ||
sdpExchangeDuration: number; | ||
sdpExchangeTransport: string; | ||
setRemoteDescDuration: number; | ||
peerConnectionDuration: number; | ||
}; | ||
@@ -182,3 +214,2 @@ /** | ||
getVideoSender(): RTCRtpSender | undefined; | ||
private parseWhipLinkExtension; | ||
/** | ||
@@ -190,2 +221,3 @@ * Sets tracks for use on action connect() | ||
initTracksToPublish(tracks: TrackWithConfig[]): void; | ||
getSfuResource(): SfuResource; | ||
} |
@@ -9,2 +9,3 @@ import { Logger } from '../../client-common/logger'; | ||
} | ||
export declare type SocketErrorReason = 'UnableToConnect' | 'PingSendError' | 'PongTimedOut' | 'UnintentionalError'; | ||
/** | ||
@@ -36,3 +37,2 @@ * StageSocket is responsible for managing the WebSocket connection to IVS | ||
private closing; | ||
private closingForError; | ||
private nextConnectionAttempt; | ||
@@ -56,3 +56,3 @@ private windowUnloading; | ||
private createWebSocket; | ||
private closeForError; | ||
private emitError; | ||
private closeSocket; | ||
@@ -82,2 +82,3 @@ /** | ||
private beforeUnload; | ||
sendSdpOffer: (sdpOffer: string, url: string, traceId: string, requestUUID: string) => void; | ||
} |
@@ -26,4 +26,36 @@ import { Logger } from '../../client-common/logger'; | ||
disconnected?: Participant[]; | ||
serverFeatures?: string[]; | ||
}; | ||
} | ||
export interface StageSdpAnswerMessage { | ||
requestId: string; | ||
httpStatusCode: number; | ||
errorCode: number; | ||
errorMessage: string; | ||
sessionDeleteLink: string; | ||
location: string; | ||
subscriberControlLink: string; | ||
content: string; | ||
contentType: string; | ||
} | ||
export declare type StageConnectionStats = { | ||
isConnected: boolean; | ||
edpInitialStartConnectTime: number; | ||
edpInitialFinishConnectTime: number; | ||
edpConnectCount: number; | ||
edpInitialConnectDuration: number; | ||
edpConnectDuration: number; | ||
edpInitialStateDuration: number; | ||
edpInitialStatePublishingCount: number; | ||
edpStateUpdateCount: number; | ||
edpInitialConnectAttempts: number; | ||
}; | ||
export declare enum StageConnectionSdpExchangeRejectionReason { | ||
NOT_CONNECTED = 0, | ||
CONNECTION_LOST = 1, | ||
TIMEDOUT = 2, | ||
ABORTED = 3, | ||
INVALID_MESSAGE = 4, | ||
UNEXPECTED_ERROR = 5 | ||
} | ||
export declare enum StageConnectionState { | ||
@@ -66,2 +98,4 @@ /** | ||
private traceId?; | ||
private features; | ||
private stats; | ||
private uploadStageMinutesBroadcastInterval?; | ||
@@ -71,2 +105,3 @@ private stageMinutesLogged; | ||
constructor(nonScopedLogger: Logger); | ||
private resetStats; | ||
private onConnecting; | ||
@@ -111,2 +146,4 @@ private onConnected; | ||
emitStageState(audioMuted: boolean, videoStopped: boolean): void; | ||
private measureConnect; | ||
private measureStateUpdate; | ||
private trackConnectedEvent; | ||
@@ -135,2 +172,9 @@ private trackDisconnectedEvent; | ||
/** | ||
* Checks server features and enables this stage connections features | ||
* based on its value(s) | ||
* | ||
* @param serverFeatures - The array of server features supported | ||
*/ | ||
private enableFeaturesBasedOnServerFeatures; | ||
/** | ||
* This is a private function for handling Stage messages | ||
@@ -142,3 +186,14 @@ * | ||
isConnected(): boolean; | ||
supportsSdpExchange(): boolean; | ||
/** | ||
* Returns stats for this StageConnection | ||
* | ||
* @returns the connection's stats | ||
*/ | ||
getConnectionStats(): StageConnectionStats; | ||
/** | ||
* Does the SDP exchange over the StageConnection | ||
*/ | ||
exchangeSdp(sdpOffer: string, url: string, traceId: string, requestUUID: string, signal: AbortSignal): Promise<StageSdpAnswerMessage>; | ||
} | ||
export {}; |
/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
import { Participant, StageStateMessage } from './stage-connection'; | ||
import { SubscriptionConnectionState } from './stage-subscription'; | ||
import { Participant, StageSdpAnswerMessage, StageStateMessage } from './stage-connection'; | ||
import { StageSubscriptionState } from './stage-subscription'; | ||
export declare const BroadcastStageConnectionEvents: { | ||
@@ -59,3 +59,3 @@ /** | ||
* | ||
* @param payload - [[SubscriptionConnectionState]] | ||
* @param payload - [[StageSubscriptionState]] | ||
* @event connectionState | ||
@@ -100,2 +100,6 @@ */ | ||
readonly STAGE_STATE_MESSAGE: "stageStateMessage"; | ||
/** | ||
* Indicates the socket has received an SDP answer | ||
*/ | ||
readonly SDP_ANSWER: "sdpAnswer"; | ||
}; | ||
@@ -112,3 +116,3 @@ /** | ||
export interface BroadcastStageSubscriptionEventPayloads { | ||
[BroadcastStageSubscriptionEvents.CONNECTION_STATE_CHANGE]: SubscriptionConnectionState; | ||
[BroadcastStageSubscriptionEvents.CONNECTION_STATE_CHANGE]: StageSubscriptionState; | ||
[BroadcastStageSubscriptionEvents.STAGE_STREAM_UPDATE]: MediaStream; | ||
@@ -125,2 +129,3 @@ } | ||
[BroadcastStageSocketEvents.REFRESH]: void; | ||
[BroadcastStageSocketEvents.SDP_ANSWER]: StageSdpAnswerMessage; | ||
} |
@@ -5,2 +5,3 @@ import { Logger } from '../../client-common/logger'; | ||
import { TypedEmitter } from './typed-emitter'; | ||
import { StageConnection } from './stage-connection'; | ||
export declare enum StagePublicationState { | ||
@@ -52,2 +53,3 @@ DISCONNECTED = "disconnected", | ||
private token; | ||
private stageConnection; | ||
private nonScopedLogger; | ||
@@ -61,3 +63,3 @@ private traceId; | ||
private latestPubAttemptNum; | ||
constructor(token: StageToken, nonScopedLogger: Logger, traceId: TraceId); | ||
constructor(token: StageToken, stageConnection: StageConnection, nonScopedLogger: Logger, traceId: TraceId); | ||
start: (tracks: TrackWithConfig[]) => void; | ||
@@ -78,4 +80,6 @@ requestRTCStats: (track: MediaStreamTrack) => Promise<RTCStatsReport | undefined>; | ||
private trackPublishStarted; | ||
private trackPublishFailed; | ||
private trackPublishErrorDeprecated; | ||
private trackPublishEnded; | ||
} | ||
export {}; |
@@ -6,13 +6,12 @@ import { Logger } from '../../client-common/logger'; | ||
import { StageToken } from './token'; | ||
export declare enum SubscriptionConnectionState { | ||
export declare enum StageSubscriptionState { | ||
DISCONNECTED = "disconnected", | ||
INIT = "init", | ||
CONNECTING = "connecting", | ||
CONNECTED = "connected", | ||
UNSTABLE = "unstable", | ||
PAUSED = "paused", | ||
FAILED = "failed", | ||
STOPPED = "stopped" | ||
FAILED = "failed" | ||
} | ||
export declare type SubscriptionState = { | ||
connectionState: SubscriptionConnectionState; | ||
connectionState: StageSubscriptionState; | ||
subscribeInProgress: boolean; | ||
@@ -50,3 +49,2 @@ }; | ||
private throttler; | ||
private retryOnlyNonFatalErrors; | ||
constructor(id: string, token: StageToken, stageConnection: StageConnection, nonScopedLogger: Logger, traceId: TraceId); | ||
@@ -75,3 +73,3 @@ /** | ||
*/ | ||
private onSignalStateChange; | ||
private processStateUpdate; | ||
/** | ||
@@ -85,3 +83,3 @@ * Move the state into FAILED and re-attempt a subscribe but not immediately | ||
*/ | ||
private onAttemptSubscribeFailure; | ||
private onTrySubscribeFailure; | ||
/** | ||
@@ -94,9 +92,2 @@ * Activates a subscription. Callers should listen for CONNECTED event that | ||
/** | ||
* Set whether to retry only on non-fatal errors or not. | ||
* TODO: Remove this toggle once we've gained confidence to enable always. | ||
* | ||
* @param value - Set true to enable retries only on non-fatal errors | ||
*/ | ||
setRetryOnlyNonFatalErrors: (value: boolean) => void; | ||
/** | ||
* Attempt to subscribe | ||
@@ -107,5 +98,5 @@ * | ||
*/ | ||
private attemptSubscribe; | ||
throttledAttemptSubscribe(reason?: string): boolean; | ||
private changeState; | ||
private trySubscribe; | ||
throttledTrySubscribe(reason?: string): boolean; | ||
private updateState; | ||
/** | ||
@@ -126,10 +117,6 @@ * Registers (starts) a specified callback to a specified event. | ||
/** | ||
* Inactivates a subscription and cleans up | ||
* Stops a subscription and cleans up | ||
*/ | ||
stop(): void; | ||
/** | ||
* Cleans up this subscription. | ||
*/ | ||
private cleanUp; | ||
/** | ||
* Get the active state of the subscription | ||
@@ -140,8 +127,2 @@ * | ||
isActive(): boolean; | ||
/** | ||
* Return the current StageSubscriptionState | ||
* | ||
* @returns The current StageSubscriptionState | ||
*/ | ||
getSubscriptionConnectionState(): SubscriptionConnectionState; | ||
private subscribe; | ||
@@ -151,4 +132,6 @@ private unsubscribe; | ||
private trackSubscribeRequested; | ||
private trackSubscribeStartedEvent; | ||
private trackSubscribeStarted; | ||
private trackSubscribeFailed; | ||
private trackSubscribeErrorDeprecated; | ||
private trackSubscribeEnded; | ||
} |
@@ -22,3 +22,2 @@ import { Action } from './constants'; | ||
topic: string; | ||
active_participants: string[]; | ||
}; | ||
@@ -40,3 +39,2 @@ declare class StageToken { | ||
attrGsSessionId?: string; | ||
activeParticipants: string[]; | ||
private analyticsTracker; | ||
@@ -57,2 +55,2 @@ constructor(encodedToken: string); | ||
}): string; | ||
export { StageToken, parseStageToken, parseTokenForDataplaneURL }; | ||
export { type ClaimsAttributes, type ClaimsCapabilities, StageToken, parseStageToken, parseTokenForDataplaneURL }; |
@@ -19,3 +19,2 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
private left; | ||
private retryOnlyOnFatalErrors; | ||
constructor(info: StageParticipantInfo, token: StageToken, connection: StageConnection, logger: Logger, subscribeType: SubscribeType, isPublishing?: boolean); | ||
@@ -27,3 +26,2 @@ private onSubscriptionStateChange; | ||
updateStreamState: (audioMuted: boolean, videoStopped: boolean) => void; | ||
updateParticipantAttributes: (attributes: Record<string, unknown>) => void; | ||
private updateStreamMuteState; | ||
@@ -50,9 +48,2 @@ participantLeave(): void; | ||
quickUnsubscribe: () => false | void; | ||
/** | ||
* Set whether to retry only on fatal errors or not. | ||
* TODO: Remove this toggle once we've gained confidence to enable always. | ||
* | ||
* @param value - Set true to enable retries only on fatal errors | ||
*/ | ||
setRetryOnlyNonFatalErrors: (value: boolean) => void; | ||
} |
@@ -26,6 +26,6 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
readonly userId: string; | ||
readonly attributes: Record<string, unknown>; | ||
readonly capabilities: Set<StageParticipantCapabilities>; | ||
readonly isLocal: boolean; | ||
readonly userInfo: Record<string, unknown>; | ||
attributes: Record<string, unknown>; | ||
videoStopped: boolean; | ||
@@ -32,0 +32,0 @@ audioMuted: boolean; |
@@ -72,3 +72,13 @@ import { TrackType as StreamType } from '../../client-common/utils/media-track-helpers'; | ||
export interface StageAudioConfiguration { | ||
/** | ||
* Max bitrate of the audio stream in Kbps. Value is limited to values | ||
* between 12 and 128. Default is 64Kbps. | ||
*/ | ||
maxAudioBitrateKbps?: number; | ||
/** | ||
* Explicitly enable stereo (true) or mono (false) for the audio stream. | ||
* Note that if using a audio source retrieved with getUserMedia you must | ||
* disable autoGainControl, echoCancellation, and noiseSuppression | ||
* constraints when enabling stereo. | ||
*/ | ||
stereo?: boolean; | ||
@@ -75,0 +85,0 @@ } |
import { LogLevels } from '../../client-common/logger/logger.types'; | ||
import { OverrideConfig, globalOverrideKey } from '../../client-common/override-config'; | ||
import { TypedEmitter } from '../core-api/typed-emitter'; | ||
@@ -7,2 +8,3 @@ import { StageConnectionState } from '../core-api/stage-connection'; | ||
import { StageStream } from './stage-stream'; | ||
/** @hidden */ | ||
declare global { | ||
@@ -13,2 +15,3 @@ interface Window { | ||
IVS_DATA_PLANE_ENDPOINT?: string; | ||
[globalOverrideKey]?: OverrideConfig; | ||
} | ||
@@ -25,3 +28,2 @@ } | ||
private participants; | ||
private prepackedParticipants; | ||
private localParticipant?; | ||
@@ -40,6 +42,4 @@ private connectionStateErrored; | ||
private setupListeners; | ||
private setupPrepackedParticipants; | ||
private onConnectionStateChanged; | ||
private onLocalParticipantJoined; | ||
private checkPrepacked; | ||
private onRemoteParticipantJoined; | ||
@@ -46,0 +46,0 @@ private setupRemoteParticipantListeners; |
{ | ||
"name": "amazon-ivs-web-broadcast", | ||
"version": "1.6.1-rc.0", | ||
"version": "1.7.0", | ||
"description": "Amazon IVS Web Broadcast SDK", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
610410
158
5311
0
28
1
2
0
13