amazon-ivs-web-broadcast
Advanced tools
Comparing version 1.12.0 to 1.13.0
@@ -12,3 +12,2 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
analyticsPostUrl?: string; | ||
disableFatalSubscribeRetries?: boolean; | ||
enableFirstFrameAudio?: boolean; | ||
@@ -58,9 +57,2 @@ } | ||
/** | ||
* Internal API to read if subscribes should not retry on fatal errors | ||
* | ||
* @hidden | ||
* @returns - Boolean if specified in override config, else undefined. | ||
*/ | ||
export declare function isFatalSubscribeRetriesDisabled(): boolean | undefined; | ||
/** | ||
* Internal API to read if first frame analytics events should be emitted | ||
@@ -67,0 +59,0 @@ * for audio media types. |
@@ -9,2 +9,3 @@ /// <reference types="jest" /> | ||
getTracks: jest.Mock<any, any>; | ||
getSenders: jest.Mock<any, any>; | ||
addStream: jest.Mock<any, any>; | ||
@@ -11,0 +12,0 @@ createOffer: jest.Mock<any, any>; |
@@ -57,2 +57,3 @@ import { BroadcastClientError } from '../../../client-common/errors'; | ||
readonly UNPUBLISH_RELATED: "webrtc_unsink"; | ||
readonly SUBSCRIBE_RELATED: "webrtc_source"; | ||
}; | ||
@@ -461,2 +462,8 @@ export declare function errorTagByAction(action: Action, subscriberId?: string): string; | ||
}; | ||
readonly NETWORK_FAILURE: { | ||
readonly code: 1406; | ||
readonly message: "Failed due to network problem"; | ||
readonly fatal: false; | ||
readonly nominal: false; | ||
}; | ||
}; | ||
@@ -463,0 +470,0 @@ export declare enum STAGE_PUBSUB_ENDED_REASON { |
@@ -59,4 +59,18 @@ import { AnalyticsTracker } from '../../client-common/analytics/analytics-tracker'; | ||
private uploadSubscriberStats; | ||
private getPrevVideoStat; | ||
/** | ||
* Returns the inbound and previous inbound stat report for audio | ||
* | ||
* @param stat - The current stat | ||
* @returns an object with inbound and prevInbound | ||
*/ | ||
private updateInboundAudio; | ||
/** | ||
* Returns the inbound and previous inbound stat report for video | ||
* | ||
* @param stat - The current stat | ||
* @returns an object with inbound and prevInbound | ||
*/ | ||
private updateInboundVideo; | ||
private getPrevOutboundVideo; | ||
private setPrevVideoStat; | ||
} |
@@ -54,10 +54,2 @@ import { SfuResource } from '../../client-common/types'; | ||
/** | ||
* 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 | ||
@@ -64,0 +56,0 @@ * it wil update the transceivers so that they are publishing the correct tracks. This is a |
@@ -62,3 +62,3 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
USER_INITIATED = "user-initiated", | ||
RECONNECT = "reconnect", | ||
CLIENT_RECONNECT = "reconnect", | ||
TOKEN_REUSED = "token-reused", | ||
@@ -65,0 +65,0 @@ UNKNOWN = "unknown", |
import { TypedEmitter } from './typed-emitter'; | ||
/** | ||
* Stage error category | ||
* The category of an error. The category of the error is determined based on if | ||
* it is related to the connection to the stage (i.e. `JOIN_ERROR`), sending | ||
* media to the stage (i.e.`PUBLISH_ERROR`), or receiving an incoming media | ||
* stream from the stage (i.e. `SUBSCRIBE_ERROR`). | ||
* | ||
* @internal | ||
* @public | ||
*/ | ||
export declare enum StageErrorCategory { | ||
JOIN_ERROR = "JOIN_ERROR" | ||
/** | ||
* An error related to the connection to the stage. | ||
*/ | ||
JOIN_ERROR = "JOIN_ERROR", | ||
/** | ||
* An error related to publishing or sending media stream to the stage. | ||
*/ | ||
PUBLISH_ERROR = "PUBLISH_ERROR", | ||
/** | ||
* An error related to subscribing or receiving media stream from the stage. | ||
*/ | ||
SUBSCRIBE_ERROR = "SUBSCRIBE_ERROR" | ||
} | ||
/** | ||
* Stage error codes that we publicly emit | ||
* Stage error codes. Stage error codes are returned when a problem is | ||
* encountered that the SDK cannot recover from and require app intervention. | ||
* | ||
* @internal | ||
* @public | ||
*/ | ||
export declare enum StageErrorCode { | ||
/** | ||
* Token is malformed. Ensure the token is not being unexpectantly modified | ||
* (i.e. spaces inserted, characters changed, etc.) before being passed to | ||
* the stage. Create a valid token and retry joining. | ||
*/ | ||
TOKEN_MALFORMED = 1, | ||
/** | ||
* Token is expired. Create a non-expired token and retry joining. | ||
*/ | ||
TOKEN_EXPIRED = 2, | ||
/** | ||
* Operation timed out. If the {@link StageErrorCategory} is `JOIN_ERROR` | ||
* then check if the stage exists and the token is valid. If the stage | ||
* exists and the token is valid, this failure is likely a network issue. In | ||
* that case, wait for the device’s connectivity to recover and either | ||
* refresh the strategy or leave and rejoin the stage. | ||
*/ | ||
TIMEOUT = 3, | ||
/** | ||
* Operation failed. Fatal condition encountered attempting operation. Check | ||
* error details. | ||
*/ | ||
FAILED = 4, | ||
CANCELED = 5 | ||
/** | ||
* Operation canceled. Check application code and ensure no repeated | ||
* joins/leaves/refreshStrategy/replaceStrategy invocations which may cause | ||
* repeated operations to be started and canceled before completion. | ||
*/ | ||
CANCELED = 5, | ||
/** | ||
* Stage is at capacity. Try again when stage is no longer at capacity. | ||
*/ | ||
STAGE_AT_CAPACITY = 6, | ||
/** | ||
* Codec is not supported by the stage. Check browser/platform for codec | ||
* support. | ||
*/ | ||
CODEC_MISMATCH = 7, | ||
/** | ||
* Token does not have permission for the operation. Recreate the token with | ||
* the correct permission(s) and try again. | ||
*/ | ||
TOKEN_NOT_ALLOWED = 8 | ||
} | ||
/** | ||
* StageError | ||
* Provides information about an error encountered by the SDK during an | ||
* operation. | ||
* | ||
* @internal | ||
* @interface StageError | ||
* @public | ||
*/ | ||
export interface StageError { | ||
/** | ||
* Name of the error | ||
*/ | ||
readonly name: string; | ||
/** | ||
* {@link StageErrorCode} of the error | ||
*/ | ||
readonly code: StageErrorCode; | ||
/** | ||
* {@link StageErrorCategory} of the error | ||
*/ | ||
readonly category: StageErrorCategory; | ||
/** | ||
* Message of the error | ||
*/ | ||
readonly message: string; | ||
@@ -74,4 +141,4 @@ } | ||
*/ | ||
handleError: (err: unknown, emit?: boolean) => StageError | undefined; | ||
handleError: (err: unknown, category: StageErrorCategory, emit?: boolean) => StageError | undefined; | ||
} | ||
export {}; |
@@ -79,2 +79,9 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
readonly STAGE_STREAM_UPDATE: "stageStreamUpdate"; | ||
/** | ||
* Indicates that an error was encountered | ||
* | ||
* @param payload - [[StageClientError]] | ||
* @event error | ||
*/ | ||
readonly ERROR: "error"; | ||
}; | ||
@@ -128,6 +135,7 @@ export declare const BroadcastStageSocketEvents: { | ||
} | ||
export interface BroadcastStageSubscriptionEventPayloads { | ||
[BroadcastStageSubscriptionEvents.CONNECTION_STATE_CHANGE]: StageSubscriptionState; | ||
[BroadcastStageSubscriptionEvents.STAGE_STREAM_UPDATE]: MediaStream; | ||
} | ||
export declare type BroadcastStageSubscriptionEventPayloads = { | ||
[BroadcastStageSubscriptionEvents.CONNECTION_STATE_CHANGE]: (state: StageSubscriptionState) => void; | ||
[BroadcastStageSubscriptionEvents.STAGE_STREAM_UPDATE]: (mediaStream: MediaStream) => void; | ||
[BroadcastStageSubscriptionEvents.ERROR]: (error: StageClientError) => void; | ||
}; | ||
export interface BroadcastStageSocketEventPayloads { | ||
@@ -134,0 +142,0 @@ [BroadcastStageSocketEvents.ERROR]: StageClientError; |
import { AnalyticsTracker } from '../../client-common/analytics/analytics-tracker'; | ||
import { Logger } from '../../client-common/logger'; | ||
import { TraceId } from './analytics/random.uuid'; | ||
import { StageClientError } from './errors'; | ||
import { StageToken } from './token'; | ||
@@ -14,3 +15,4 @@ import { TypedEmitter } from './typed-emitter'; | ||
export declare enum StagePublicationEvents { | ||
STATE_CHANGE = "stateChange" | ||
STATE_CHANGE = "stateChange", | ||
ERROR = "error" | ||
} | ||
@@ -51,2 +53,3 @@ export interface TrackWithConfig { | ||
[StagePublicationEvents.STATE_CHANGE]: (stage: StagePublicationState) => void; | ||
[StagePublicationEvents.ERROR]: (error: StageClientError) => void; | ||
}; | ||
@@ -84,2 +87,3 @@ export declare class StagePublication extends TypedEmitter<PublicationEventMap> { | ||
private trackPublishFailed; | ||
private toStageClientError; | ||
private trackPublishErrorDeprecated; | ||
@@ -86,0 +90,0 @@ private trackPublishEnded; |
@@ -7,2 +7,3 @@ import { AnalyticsTracker } from '../../client-common/analytics/analytics-tracker'; | ||
import { StageToken } from './token'; | ||
import { TypedEmitter } from './typed-emitter'; | ||
export declare enum StageSubscriptionState { | ||
@@ -32,3 +33,3 @@ DISCONNECTED = "disconnected", | ||
} | ||
export declare class StageSubscription { | ||
export declare class StageSubscription extends TypedEmitter<BroadcastStageSubscriptionEventPayloads> { | ||
#private; | ||
@@ -42,3 +43,2 @@ private id; | ||
private desiredSubscribeType; | ||
private emitter; | ||
private isSubscriptionActive; | ||
@@ -125,16 +125,2 @@ private subscriptionState; | ||
/** | ||
* Registers (starts) a specified callback to a specified event. | ||
* | ||
* @param event - The event to listen to. | ||
* @param callback - The callback that will called when the event is fired. | ||
*/ | ||
on<Key extends keyof BroadcastStageSubscriptionEventPayloads & string>(event: Key, callback: (value: BroadcastStageSubscriptionEventPayloads[Key]) => void): void; | ||
/** | ||
* Deregisters (stops) a specified callback to a given event. | ||
* | ||
* @param event - The event to which the callback was registered. | ||
* @param callback - The callback to remove. | ||
*/ | ||
off<Key extends keyof BroadcastStageSubscriptionEventPayloads & string>(event: Key, callback: (value: BroadcastStageSubscriptionEventPayloads[Key]) => void): void; | ||
/** | ||
* Stops a subscription and cleans up | ||
@@ -151,2 +137,3 @@ */ | ||
private unsubscribe; | ||
private toStageClientError; | ||
private trackAndThrowUnsubscribeError; | ||
@@ -153,0 +140,0 @@ private trackSubscribeRequested; |
@@ -34,2 +34,11 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
} | ||
export declare function createMockError(val: StageErrorValue): StageClientError; | ||
declare type ErrorValProps = { | ||
code: number; | ||
message: string; | ||
fatal: boolean; | ||
nominal: boolean; | ||
}; | ||
export declare function createMockError(val: StageErrorValue | ErrorValProps): StageClientError; | ||
export declare function createMockFatalError(): StageClientError; | ||
export declare function createMockNonFatalError(): StageClientError; | ||
export {}; |
/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
import 'webrtc-adapter'; | ||
import 'reflect-metadata'; | ||
export { Stage, StageConnectionState, StageEvents } from './v2/stage'; | ||
export { Stage, StageConnectionState, StageEvents, StageLeftReason } from './v2/stage'; | ||
export { type StageError, StageErrorCategory, StageErrorCode } from './core-api/stage-error-manager'; | ||
@@ -6,0 +6,0 @@ export { LocalStageStream, RemoteStageStream, StageStream } from './v2/stage-stream'; |
/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
import { StageClientError } from '../../core-api/errors'; | ||
import { RemoteStageStream, LocalStageStream } from '../stage-stream'; | ||
@@ -32,3 +33,10 @@ import { StageParticipantInfo, StageParticipantPublishState, StageParticipantSubscribeState } from './stage-participant'; | ||
*/ | ||
MEDIA_STREAM_MUTE_CHANGED = "mediaStreamMuteChanged" | ||
MEDIA_STREAM_MUTE_CHANGED = "mediaStreamMuteChanged", | ||
/** | ||
* Indicates that a participant has encountered an error | ||
* | ||
* @param payload - [[StageClientError]] | ||
* @event error | ||
*/ | ||
ERROR = "error" | ||
} | ||
@@ -50,2 +58,3 @@ declare enum BaseRemoteParticipantEvents { | ||
MEDIA_STREAM_MUTE_CHANGED: BaseParticipantEvents.MEDIA_STREAM_MUTE_CHANGED; | ||
ERROR: BaseParticipantEvents.ERROR; | ||
}; | ||
@@ -59,2 +68,3 @@ export declare type RemoteParticipantEvents = typeof RemoteParticipantEvents; | ||
[RemoteParticipantEvents.MEDIA_STREAM_MUTE_CHANGED]: (stream: RemoteStageStream) => void; | ||
[RemoteParticipantEvents.ERROR]: (error: StageClientError) => void; | ||
}; | ||
@@ -76,2 +86,3 @@ declare enum BaseLocalParticipantEvents { | ||
MEDIA_STREAM_MUTE_CHANGED: BaseParticipantEvents.MEDIA_STREAM_MUTE_CHANGED; | ||
ERROR: BaseParticipantEvents.ERROR; | ||
}; | ||
@@ -83,3 +94,4 @@ export declare type LocalParticipantEvents = typeof LocalParticipantEvents; | ||
[LocalParticipantEvents.MEDIA_STREAM_MUTE_CHANGED]: (stream: LocalStageStream) => void; | ||
[LocalParticipantEvents.ERROR]: (error: StageClientError) => void; | ||
}; | ||
export {}; |
@@ -20,2 +20,3 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
private onPublicationStateChange; | ||
private onPublicationError; | ||
private updatePublishState; | ||
@@ -22,0 +23,0 @@ handleMute: (stream: LocalStageStream) => void; |
@@ -29,2 +29,3 @@ /*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ | ||
private onSubscriptionMediaStream; | ||
private onSubscriptionError; | ||
updateSubscribeStateIfNecessary: (newSubscribeType: SubscribeType) => void; | ||
@@ -31,0 +32,0 @@ updatePublishState: (isPublishing: boolean) => boolean; |
@@ -78,2 +78,35 @@ import { LogLevels } from '../../client-common/logger/logger.types'; | ||
export { StageConnectionState }; | ||
/** | ||
* Reasons the stage was disconnected. | ||
* | ||
* @internal | ||
* @enum | ||
*/ | ||
export declare enum StageLeftReason { | ||
/** | ||
* Unknown reason, usually due to the server explicitly disconnecting the | ||
* connection. | ||
*/ | ||
UNKNOWN = "unknown", | ||
/** | ||
* Explicit invocation of leave() by the client. | ||
*/ | ||
USER_INITIATED = "user-initiated", | ||
/** | ||
* Token was reused by another stage instance and this instance was | ||
* disconnected. A token cannot be used to maintain more than one connection | ||
* to a stage at once. | ||
*/ | ||
TOKEN_REUSED = "token-reused", | ||
/** | ||
* This token was disconnected by the DisconnectParticipant API. This token | ||
* can no longer be used. | ||
*/ | ||
PARTICIPANT_DISCONNECTED = "participant-disconnected", | ||
/** | ||
* The stage the token was tied to was deleted. This token can no longer be | ||
* used. | ||
*/ | ||
STAGE_DELETED = "stage-deleted" | ||
} | ||
declare type StageEventMap = { | ||
@@ -89,2 +122,3 @@ [StageEvents.STAGE_CONNECTION_STATE_CHANGED]: (state: StageConnectionState) => void; | ||
[StageEvents.ERROR]: (error: StageError) => void; | ||
[StageEvents.STAGE_LEFT]: (reason: StageLeftReason) => void; | ||
}; | ||
@@ -154,9 +188,17 @@ /** | ||
/** | ||
* Indicates a change to participant publish state | ||
* Indicates the stage has encountered an error. | ||
* | ||
* @param payload - [ StageError ] | ||
* @param payload - {@link StageError} | ||
* @event error | ||
* @public | ||
*/ | ||
ERROR = "error", | ||
/** | ||
* Indicates the stage has been left by the client | ||
* | ||
* @param payload - [ StageLeftReason ] | ||
* @event reason | ||
* @internal | ||
*/ | ||
ERROR = "error" | ||
STAGE_LEFT = "stageLeft" | ||
} |
{ | ||
"name": "amazon-ivs-web-broadcast", | ||
"version": "1.12.0", | ||
"version": "1.13.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
673735
166
5971