@100mslive/hms-video-store
Advanced tools
Comparing version 0.12.14-alpha.0 to 0.12.14-alpha.1
@@ -0,1 +1,2 @@ | ||
import IConnectionObserver, { RTCIceCandidatePair } from './IConnectionObserver'; | ||
import { HMSConnectionRole } from './model'; | ||
@@ -5,9 +6,6 @@ import { HMSLocalTrack } from '../media/tracks'; | ||
import JsonRpcSignal from '../signal/jsonrpc'; | ||
interface RTCIceCandidatePair { | ||
local: RTCIceCandidate; | ||
remote: RTCIceCandidate; | ||
} | ||
export default abstract class HMSConnection { | ||
readonly role: HMSConnectionRole; | ||
protected readonly signal: JsonRpcSignal; | ||
protected abstract readonly observer: IConnectionObserver; | ||
abstract readonly nativeConnection: RTCPeerConnection; | ||
@@ -38,3 +36,3 @@ /** | ||
getSenders(): Array<RTCRtpSender>; | ||
logSelectedIceCandidatePairs(): void; | ||
handleSelectedIceCandidatePairs(): void; | ||
removeTrack(sender: RTCRtpSender): void; | ||
@@ -46,2 +44,1 @@ setMaxBitrateAndFramerate(track: HMSLocalTrack): Promise<void>; | ||
} | ||
export {}; |
@@ -0,4 +1,10 @@ | ||
export interface RTCIceCandidatePair { | ||
local?: RTCIceCandidate; | ||
remote?: RTCIceCandidate; | ||
} | ||
export default interface IConnectionObserver { | ||
onIceConnectionChange(newState: RTCIceConnectionState): void; | ||
onConnectionStateChange(newState: RTCPeerConnectionState): void; | ||
onIceCandidate(candidate: RTCIceCandidate): void; | ||
onSelectedCandidatePairChange(candidatePair: RTCIceCandidatePair): void; | ||
} |
@@ -6,3 +6,3 @@ import { IPublishConnectionObserver } from './IPublishConnectionObserver'; | ||
private readonly TAG; | ||
private readonly observer; | ||
protected readonly observer: IPublishConnectionObserver; | ||
readonly nativeConnection: RTCPeerConnection; | ||
@@ -9,0 +9,0 @@ readonly channel: RTCDataChannel; |
@@ -10,3 +10,3 @@ import ISubscribeConnectionObserver from './ISubscribeConnectionObserver'; | ||
private readonly remoteStreams; | ||
private readonly observer; | ||
protected readonly observer: ISubscribeConnectionObserver; | ||
private readonly MAX_RETRIES; | ||
@@ -13,0 +13,0 @@ readonly nativeConnection: RTCPeerConnection; |
@@ -11,2 +11,3 @@ import { HMSInternalEvent } from './HMSInternalEvent'; | ||
private eventEmitter; | ||
readonly analytics: HMSInternalEvent<AnalyticsEvent>; | ||
readonly deviceChange: HMSInternalEvent<HMSDeviceChangeEvent>; | ||
@@ -35,3 +36,2 @@ readonly localAudioEnabled: HMSInternalEvent<{ | ||
}>; | ||
readonly analytics: HMSInternalEvent<AnalyticsEvent>; | ||
readonly policyChange: HMSInternalEvent<PolicyParams>; | ||
@@ -38,0 +38,0 @@ readonly localRoleUpdate: HMSInternalEvent<{ |
@@ -0,1 +1,2 @@ | ||
import { HMSDiagnosticsInterface } from './diagnostics/interfaces'; | ||
import { TranscriptionConfig } from './interfaces/transcription-config'; | ||
@@ -485,2 +486,3 @@ import { FindPeerByNameRequestParams } from './signal/interfaces'; | ||
setPlaylistSettings(settings: HMSPlaylistSettings): void; | ||
initDiagnostics(): HMSDiagnosticsInterface; | ||
} |
@@ -13,2 +13,3 @@ export type { IStoreReadOnly, IHMSStore, IHMSStoreReadOnly as HMSStoreWrapper, IHMSStatsStore, IHMSStatsStoreReadOnly as HMSStatsStoreWrapper, } from './IHMSStore'; | ||
export type { HMSVideoPlugin, HMSAudioPlugin, HMSMediaStreamPlugin, HMSPluginSupportResult, HMSFrameworkInfo, } from './internal'; | ||
export * from './diagnostics'; | ||
export { DomainCategory } from './analytics/AnalyticsEventDomains'; |
import { State } from 'zustand/vanilla'; | ||
import { HMSNotifications } from './HMSNotifications'; | ||
import { HMSDiagnosticsInterface } from '../diagnostics/interfaces'; | ||
import { IHMSActions } from '../IHMSActions'; | ||
@@ -21,2 +22,3 @@ import { IHMSStatsStoreReadOnly, IHMSStore, IHMSStoreReadOnly, IStore } from '../IHMSStore'; | ||
private stats?; | ||
private diagnostics?; | ||
/** @TODO store flag for both HMSStore and HMSInternalsStore */ | ||
@@ -63,2 +65,3 @@ private initialTriggerOnSubscribe; | ||
getStats: () => IHMSStatsStoreReadOnly; | ||
getDiagnosticsSDK: () => HMSDiagnosticsInterface; | ||
/** | ||
@@ -65,0 +68,0 @@ * @internal |
import { HMSNotifications } from './HMSNotifications'; | ||
import { Diagnostics } from '../diagnostics'; | ||
import { IHMSActions } from '../IHMSActions'; | ||
@@ -132,2 +133,3 @@ import { IHMSStore } from '../IHMSStore'; | ||
enableBeamSpeakerLabelsLogging(): Promise<void>; | ||
initDiagnostics(): Diagnostics; | ||
private resetState; | ||
@@ -134,0 +136,0 @@ private sdkJoinWithListeners; |
import { HMSLocalPeer } from './models/peer'; | ||
import { HMSPeerListIterator } from './HMSPeerListIterator'; | ||
import { LocalTrackManager } from './LocalTrackManager'; | ||
import { Store } from './store'; | ||
import { HMSAnalyticsLevel } from '../analytics/AnalyticsEventLevel'; | ||
import { DeviceManager } from '../device-manager'; | ||
import { AudioOutputManager } from '../device-manager/AudioOutputManager'; | ||
import { HMSDiagnosticsConnectivityListener } from '../diagnostics/interfaces'; | ||
import { HMSChangeMultiTrackStateParams, HMSConfig, HMSConnectionQualityListener, HMSFrameworkInfo, HMSPlaylistSettings, HMSPreviewConfig, HMSRole, HMSRoleChangeRequest, HMSScreenShareConfig, TokenRequest, TokenRequestOptions } from '../interfaces'; | ||
@@ -22,3 +25,3 @@ import { HLSConfig, HLSTimedMetadata } from '../interfaces/hls-config'; | ||
private readonly TAG; | ||
private listener?; | ||
listener?: HMSUpdateListener; | ||
private errorListener?; | ||
@@ -29,3 +32,4 @@ private deviceChangeListener?; | ||
private notificationManager?; | ||
private deviceManager; | ||
/** @internal */ | ||
deviceManager: DeviceManager; | ||
private audioSinkManager; | ||
@@ -36,3 +40,4 @@ private playlistManager; | ||
private roleChangeManager?; | ||
private localTrackManager; | ||
/** @internal */ | ||
localTrackManager: LocalTrackManager; | ||
private analyticsEventsService; | ||
@@ -50,3 +55,4 @@ private analyticsTimer; | ||
private initNotificationManager; | ||
private initStoreAndManagers; | ||
/** @internal */ | ||
initStoreAndManagers(listener: HMSPreviewListener | HMSUpdateListener | HMSDiagnosticsConnectivityListener): void; | ||
private validateJoined; | ||
@@ -143,3 +149,4 @@ private sendHLSAnalytics; | ||
private cleanDeviceManagers; | ||
private initPreviewTrackAudioLevelMonitor; | ||
/** @internal */ | ||
initPreviewTrackAudioLevelMonitor(): void; | ||
private notifyJoin; | ||
@@ -146,0 +153,0 @@ /** |
@@ -21,6 +21,6 @@ import { Store } from './store'; | ||
private eventBus; | ||
private analyticsTimer; | ||
private analyticsTimer?; | ||
readonly TAG: string; | ||
private captureHandleIdentifier?; | ||
constructor(store: Store, observer: ITransportObserver, deviceManager: DeviceManager, eventBus: EventBus, analyticsTimer: AnalyticsTimer); | ||
constructor(store: Store, observer: Pick<ITransportObserver, 'onFailure'>, deviceManager: DeviceManager, eventBus: EventBus, analyticsTimer?: AnalyticsTimer | undefined); | ||
getTracksToPublish(initialSettings?: InitialSettings): Promise<HMSLocalTrack[]>; | ||
@@ -27,0 +27,0 @@ /** |
@@ -8,2 +8,3 @@ import ITransportObserver from './ITransportObserver'; | ||
import { DeviceManager } from '../device-manager'; | ||
import { HMSDiagnosticsConnectivityListener } from '../diagnostics/interfaces'; | ||
import { EventBus } from '../events/EventBus'; | ||
@@ -36,2 +37,3 @@ import { HMSICEServer, HMSRole } from '../interfaces'; | ||
private maxSubscribeBitrate; | ||
private connectivityListener?; | ||
joinRetryCount: number; | ||
@@ -54,2 +56,3 @@ constructor(observer: ITransportObserver, deviceManager: DeviceManager, store: Store, eventBus: EventBus, analyticsEventsService: AnalyticsEventsService, analyticsTimer: AnalyticsTimer, pluginUsageTracker: PluginUsageTracker); | ||
isFlagEnabled(flag: InitFlags): boolean; | ||
setConnectivityListener(listener: HMSDiagnosticsConnectivityListener): void; | ||
preview(token: string, endpoint: string, peerId: string, customData: { | ||
@@ -56,0 +59,0 @@ name: string; |
{ | ||
"version": "0.12.14-alpha.0", | ||
"version": "0.12.14-alpha.1", | ||
"license": "MIT", | ||
@@ -76,3 +76,3 @@ "repository": { | ||
], | ||
"gitHead": "8e40f00818c7057c6cdf817982d7ded8a4d44426" | ||
"gitHead": "92efc31642f74553fa513d53112e9e680c88bc8b" | ||
} |
@@ -0,1 +1,2 @@ | ||
import IConnectionObserver, { RTCIceCandidatePair } from './IConnectionObserver'; | ||
import { HMSConnectionRole } from './model'; | ||
@@ -11,6 +12,2 @@ import { ErrorFactory } from '../error/ErrorFactory'; | ||
const TAG = '[HMSConnection]'; | ||
interface RTCIceCandidatePair { | ||
local: RTCIceCandidate; | ||
remote: RTCIceCandidate; | ||
} | ||
@@ -21,2 +18,3 @@ export default abstract class HMSConnection { | ||
protected abstract readonly observer: IConnectionObserver; | ||
abstract readonly nativeConnection: RTCPeerConnection; | ||
@@ -113,3 +111,3 @@ /** | ||
logSelectedIceCandidatePairs() { | ||
handleSelectedIceCandidatePairs() { | ||
/** | ||
@@ -131,3 +129,3 @@ * for the very first peer in the room we don't have any subscribe ice candidates | ||
const logSelectedCandidate = () => { | ||
const handleSelectedCandidate = () => { | ||
// @ts-expect-error | ||
@@ -137,8 +135,11 @@ if (typeof iceTransport.getSelectedCandidatePair === 'function') { | ||
this.selectedCandidatePair = iceTransport.getSelectedCandidatePair(); | ||
HMSLogger.d( | ||
TAG, | ||
`${HMSConnectionRole[this.role]} connection`, | ||
`selected ${kindOfTrack || 'unknown'} candidate pair`, | ||
JSON.stringify(this.selectedCandidatePair, null, 2), | ||
); | ||
if (this.selectedCandidatePair) { | ||
this.observer.onSelectedCandidatePairChange(this.selectedCandidatePair); | ||
HMSLogger.d( | ||
TAG, | ||
`${HMSConnectionRole[this.role]} connection`, | ||
`selected ${kindOfTrack || 'unknown'} candidate pair`, | ||
JSON.stringify(this.selectedCandidatePair, null, 2), | ||
); | ||
} | ||
} | ||
@@ -150,5 +151,5 @@ }; | ||
// @ts-expect-error | ||
iceTransport.onselectedcandidatepairchange = logSelectedCandidate; | ||
iceTransport.onselectedcandidatepairchange = handleSelectedCandidate; | ||
} | ||
logSelectedCandidate(); | ||
handleSelectedCandidate(); | ||
} | ||
@@ -155,0 +156,0 @@ }); |
@@ -0,1 +1,6 @@ | ||
export interface RTCIceCandidatePair { | ||
local?: RTCIceCandidate; | ||
remote?: RTCIceCandidate; | ||
} | ||
export default interface IConnectionObserver { | ||
@@ -6,2 +11,6 @@ onIceConnectionChange(newState: RTCIceConnectionState): void; | ||
onConnectionStateChange(newState: RTCPeerConnectionState): void; | ||
onIceCandidate(candidate: RTCIceCandidate): void; | ||
onSelectedCandidatePairChange(candidatePair: RTCIceCandidatePair): void; | ||
} |
@@ -10,3 +10,3 @@ import { IPublishConnectionObserver } from './IPublishConnectionObserver'; | ||
private readonly TAG = '[HMSPublishConnection]'; | ||
private readonly observer: IPublishConnectionObserver; | ||
protected readonly observer: IPublishConnectionObserver; | ||
readonly nativeConnection: RTCPeerConnection; | ||
@@ -27,2 +27,3 @@ readonly channel: RTCDataChannel; | ||
if (candidate) { | ||
this.observer.onIceCandidate(candidate); | ||
signal.trickle(this.role, candidate); | ||
@@ -29,0 +30,0 @@ } |
@@ -21,3 +21,3 @@ import EventEmitter from 'eventemitter2'; | ||
private readonly remoteStreams = new Map<string, HMSRemoteStream>(); | ||
private readonly observer: ISubscribeConnectionObserver; | ||
protected readonly observer: ISubscribeConnectionObserver; | ||
private readonly MAX_RETRIES = 3; | ||
@@ -64,2 +64,3 @@ | ||
if (e.candidate !== null) { | ||
this.observer.onIceCandidate(e.candidate); | ||
this.signal.trickle(this.role, e.candidate); | ||
@@ -66,0 +67,0 @@ } |
@@ -20,2 +20,6 @@ import { EventEmitter2 as EventEmitter } from 'eventemitter2'; | ||
private eventEmitter: EventEmitter = new EventEmitter(); | ||
readonly analytics: HMSInternalEvent<AnalyticsEvent> = new HMSInternalEvent<AnalyticsEvent>( | ||
HMSEvents.ANALYTICS, | ||
this.eventEmitter, | ||
); | ||
readonly deviceChange = new HMSInternalEvent<HMSDeviceChangeEvent>(HMSEvents.DEVICE_CHANGE, this.eventEmitter); | ||
@@ -54,4 +58,2 @@ readonly localAudioEnabled = new HMSInternalEvent<{ enabled: boolean; track: HMSLocalAudioTrack }>( | ||
readonly analytics = new HMSInternalEvent<AnalyticsEvent>(HMSEvents.ANALYTICS, this.eventEmitter); | ||
readonly policyChange = new HMSInternalEvent<PolicyParams>(HMSEvents.POLICY_CHANGE, this.eventEmitter); | ||
@@ -58,0 +60,0 @@ |
@@ -0,1 +1,2 @@ | ||
import { HMSDiagnosticsInterface } from './diagnostics/interfaces'; | ||
import { TranscriptionConfig } from './interfaces/transcription-config'; | ||
@@ -571,2 +572,4 @@ import { FindPeerByNameRequestParams } from './signal/interfaces'; | ||
setPlaylistSettings(settings: HMSPlaylistSettings): void; | ||
initDiagnostics(): HMSDiagnosticsInterface; | ||
} |
@@ -76,2 +76,3 @@ export type { | ||
} from './internal'; | ||
export * from './diagnostics'; | ||
export { DomainCategory } from './analytics/AnalyticsEventDomains'; |
@@ -16,2 +16,3 @@ import { produce } from 'immer'; | ||
import { storeNameWithTabTitle } from '../common/storeName'; | ||
import { HMSDiagnosticsInterface } from '../diagnostics/interfaces'; | ||
import { IHMSActions } from '../IHMSActions'; | ||
@@ -38,2 +39,3 @@ import { IHMSStatsStoreReadOnly, IHMSStore, IHMSStoreReadOnly, IStore } from '../IHMSStore'; | ||
private stats?: HMSStats; | ||
private diagnostics?: HMSDiagnosticsInterface; | ||
/** @TODO store flag for both HMSStore and HMSInternalsStore */ | ||
@@ -138,2 +140,10 @@ private initialTriggerOnSubscribe: boolean; | ||
getDiagnosticsSDK = (): HMSDiagnosticsInterface => { | ||
if (!this.diagnostics) { | ||
this.diagnostics = this.actions.initDiagnostics(); | ||
} | ||
return this.diagnostics; | ||
}; | ||
/** | ||
@@ -140,0 +150,0 @@ * @internal |
@@ -19,2 +19,3 @@ import { PEER_NOTIFICATION_TYPES, POLL_NOTIFICATION_TYPES, TRACK_NOTIFICATION_TYPES } from './common/mapping'; | ||
import { BeamSpeakerLabelsLogger } from '../controller/beam/BeamSpeakerLabelsLogger'; | ||
import { Diagnostics } from '../diagnostics'; | ||
import { IHMSActions } from '../IHMSActions'; | ||
@@ -803,2 +804,32 @@ import { IHMSStore } from '../IHMSStore'; | ||
} | ||
initDiagnostics() { | ||
const diagnostics = new Diagnostics(this.sdk, { | ||
onJoin: this.onJoin.bind(this), | ||
onPreview: this.onPreview.bind(this), | ||
onRoomUpdate: this.onRoomUpdate.bind(this), | ||
onPeerUpdate: this.onPeerUpdate.bind(this), | ||
onTrackUpdate: this.onTrackUpdate.bind(this), | ||
onMessageReceived: this.onMessageReceived.bind(this), | ||
onError: this.onError.bind(this), | ||
onReconnected: this.onReconnected.bind(this), | ||
onReconnecting: this.onReconnecting.bind(this), | ||
onRoleChangeRequest: this.onRoleChangeRequest.bind(this), | ||
onRoleUpdate: this.onRoleUpdate.bind(this), | ||
onDeviceChange: this.onDeviceChange.bind(this), | ||
onChangeTrackStateRequest: this.onChangeTrackStateRequest.bind(this), | ||
onChangeMultiTrackStateRequest: this.onChangeMultiTrackStateRequest.bind(this), | ||
onRemovedFromRoom: this.onRemovedFromRoom.bind(this), | ||
onNetworkQuality: this.onNetworkQuality.bind(this), | ||
onSessionStoreUpdate: this.onSessionStoreUpdate.bind(this), | ||
onPollsUpdate: this.onPollsUpdate.bind(this), | ||
onWhiteboardUpdate: this.onWhiteboardUpdate.bind(this), | ||
}); | ||
this.sdk.addAudioListener({ | ||
onAudioLevelUpdate: this.onAudioLevelUpdate.bind(this), | ||
}); | ||
this.sdk.addConnectionQualityListener({ | ||
onConnectionQualityUpdate: this.onConnectionQualityUpdate.bind(this), | ||
}); | ||
return diagnostics; | ||
} | ||
@@ -805,0 +836,0 @@ private resetState(reason = 'resetState') { |
@@ -19,2 +19,3 @@ import HMSRoom from './models/HMSRoom'; | ||
import { DeviceStorageManager } from '../device-manager/DeviceStorage'; | ||
import { HMSDiagnosticsConnectivityListener } from '../diagnostics/interfaces'; | ||
import { ErrorCodes } from '../error/ErrorCodes'; | ||
@@ -111,3 +112,3 @@ import { ErrorFactory } from '../error/ErrorFactory'; | ||
private readonly TAG = '[HMSSdk]:'; | ||
private listener?: HMSUpdateListener; | ||
public listener?: HMSUpdateListener; | ||
private errorListener?: IErrorListener; | ||
@@ -118,3 +119,4 @@ private deviceChangeListener?: DeviceChangeListener; | ||
private notificationManager?: NotificationManager; | ||
private deviceManager!: DeviceManager; | ||
/** @internal */ | ||
public deviceManager!: DeviceManager; | ||
private audioSinkManager!: AudioSinkManager; | ||
@@ -125,3 +127,4 @@ private playlistManager!: PlaylistManager; | ||
private roleChangeManager?: RoleChangeManager; | ||
private localTrackManager!: LocalTrackManager; | ||
/** @internal */ | ||
public localTrackManager!: LocalTrackManager; | ||
private analyticsEventsService!: AnalyticsEventsService; | ||
@@ -158,3 +161,9 @@ private analyticsTimer = new AnalyticsTimer(); | ||
private initStoreAndManagers() { | ||
/** @internal */ | ||
initStoreAndManagers(listener: HMSPreviewListener | HMSUpdateListener | HMSDiagnosticsConnectivityListener) { | ||
this.listener = listener as unknown as HMSUpdateListener; | ||
this.errorListener = listener; | ||
this.deviceChangeListener = listener; | ||
this.store?.setErrorListener(this.errorListener); | ||
if (this.sdkState.isInitialised) { | ||
@@ -199,2 +208,6 @@ /** | ||
); | ||
// add diagnostics callbacks if present | ||
if ((listener as unknown as HMSDiagnosticsConnectivityListener).onInitSuccess) { | ||
this.transport.setConnectivityListener(listener as unknown as HMSDiagnosticsConnectivityListener); | ||
} | ||
this.sessionStore = new SessionStore(this.transport); | ||
@@ -538,3 +551,2 @@ this.interactivityCenter = new InteractivityCenter(this.transport, this.store, this.listener); | ||
this.networkTestManager?.stop(); | ||
this.listener = listener; | ||
this.commonSetup(config, roomId, listener); | ||
@@ -1285,3 +1297,4 @@ this.removeDevicesFromConfig(config); | ||
private initPreviewTrackAudioLevelMonitor() { | ||
/** @internal */ | ||
initPreviewTrackAudioLevelMonitor() { | ||
const localAudioTrack = this.localPeer?.audioTrack; | ||
@@ -1338,3 +1351,2 @@ localAudioTrack?.initAudioLevelMonitor(); | ||
private setUpPreview(config: HMSPreviewConfig, listener: HMSPreviewListener) { | ||
this.listener = listener as unknown as HMSUpdateListener; | ||
this.sdkState.isPreviewCalled = true; | ||
@@ -1412,6 +1424,4 @@ this.sdkState.isPreviewInProgress = true; | ||
} | ||
this.errorListener = listener; | ||
this.deviceChangeListener = listener; | ||
this.initStoreAndManagers(); | ||
this.store.setErrorListener(this.errorListener); | ||
this.initStoreAndManagers(listener); | ||
if (!this.store.getRoom()) { | ||
@@ -1505,2 +1515,6 @@ this.store.setRoom(new HMSRoom(roomId)); | ||
private sendAnalyticsEvent = (event: AnalyticsEvent) => { | ||
// don't send analytics for diagnostics | ||
if ((this.listener as unknown as HMSDiagnosticsConnectivityListener).onInitSuccess) { | ||
return; | ||
} | ||
this.analyticsEventsService.queue(event).flush(); | ||
@@ -1507,0 +1521,0 @@ }; |
@@ -50,6 +50,6 @@ import { v4 as uuid } from 'uuid'; | ||
private store: Store, | ||
private observer: ITransportObserver, | ||
private observer: Pick<ITransportObserver, 'onFailure'>, | ||
private deviceManager: DeviceManager, | ||
private eventBus: EventBus, | ||
private analyticsTimer: AnalyticsTimer, | ||
private analyticsTimer?: AnalyticsTimer, | ||
) { | ||
@@ -85,6 +85,6 @@ this.setScreenCaptureHandleConfig(); | ||
if (fetchTrackOptions.audio) { | ||
this.analyticsTimer.start(TimedEvent.LOCAL_AUDIO_TRACK); | ||
this.analyticsTimer?.start(TimedEvent.LOCAL_AUDIO_TRACK); | ||
} | ||
if (fetchTrackOptions.video) { | ||
this.analyticsTimer.start(TimedEvent.LOCAL_VIDEO_TRACK); | ||
this.analyticsTimer?.start(TimedEvent.LOCAL_VIDEO_TRACK); | ||
} | ||
@@ -103,6 +103,6 @@ try { | ||
if (fetchTrackOptions.audio) { | ||
this.analyticsTimer.end(TimedEvent.LOCAL_AUDIO_TRACK); | ||
this.analyticsTimer?.end(TimedEvent.LOCAL_AUDIO_TRACK); | ||
} | ||
if (fetchTrackOptions.video) { | ||
this.analyticsTimer.end(TimedEvent.LOCAL_VIDEO_TRACK); | ||
this.analyticsTimer?.end(TimedEvent.LOCAL_VIDEO_TRACK); | ||
} | ||
@@ -109,0 +109,0 @@ |
@@ -5,2 +5,3 @@ import { InitConfig } from './models'; | ||
import { HMSICEServer } from '../../interfaces'; | ||
import { HMSException } from '../../internal'; | ||
import { transformIceServerConfig } from '../../utils/ice-server-config'; | ||
@@ -55,3 +56,5 @@ import HMSLogger from '../../utils/logger'; | ||
HMSLogger.e(TAG, 'json error', (err as Error).message, text); | ||
throw ErrorFactory.APIErrors.ServerErrors(response.status, HMSAction.INIT, text); | ||
throw err instanceof HMSException | ||
? err | ||
: ErrorFactory.APIErrors.ServerErrors(response.status, HMSAction.INIT, (err as Error).message); | ||
} | ||
@@ -58,0 +61,0 @@ } catch (err) { |
@@ -21,2 +21,3 @@ import { JoinParameters } from './models/JoinParameters'; | ||
import { DeviceManager } from '../device-manager'; | ||
import { HMSDiagnosticsConnectivityListener } from '../diagnostics/interfaces'; | ||
import { ErrorCodes } from '../error/ErrorCodes'; | ||
@@ -82,2 +83,3 @@ import { ErrorFactory } from '../error/ErrorFactory'; | ||
private maxSubscribeBitrate = 0; | ||
private connectivityListener?: HMSDiagnosticsConnectivityListener; | ||
joinRetryCount = 0; | ||
@@ -288,3 +290,4 @@ | ||
if (newState === 'connected') { | ||
this.publishConnection?.logSelectedIceCandidatePairs(); | ||
this.connectivityListener?.onICESuccess(true); | ||
this.publishConnection?.handleSelectedIceCandidatePairs(); | ||
} | ||
@@ -300,3 +303,3 @@ | ||
HMSAction.PUBLISH, | ||
`local candidate - ${this.publishConnection?.selectedCandidatePair?.local.candidate}; remote candidate - ${this.publishConnection?.selectedCandidatePair?.remote.candidate}`, | ||
`local candidate - ${this.publishConnection?.selectedCandidatePair?.local?.candidate}; remote candidate - ${this.publishConnection?.selectedCandidatePair?.remote?.candidate}`, | ||
), | ||
@@ -313,3 +316,3 @@ ); | ||
HMSAction.PUBLISH, | ||
`local candidate - ${this.publishConnection?.selectedCandidatePair?.local.candidate}; remote candidate - ${this.publishConnection?.selectedCandidatePair?.remote.candidate}`, | ||
`local candidate - ${this.publishConnection?.selectedCandidatePair?.local?.candidate}; remote candidate - ${this.publishConnection?.selectedCandidatePair?.remote?.candidate}`, | ||
), | ||
@@ -319,2 +322,10 @@ ); | ||
}, | ||
onIceCandidate: candidate => { | ||
this.connectivityListener?.onICECandidate(candidate, true); | ||
}, | ||
onSelectedCandidatePairChange: candidatePair => { | ||
this.connectivityListener?.onSelectedICECandidatePairChange(candidatePair, true); | ||
}, | ||
}; | ||
@@ -349,2 +360,3 @@ | ||
this.connectivityListener?.onICESuccess(false); | ||
if (callback) { | ||
@@ -366,3 +378,3 @@ callback.promise.resolve(true); | ||
HMSAction.SUBSCRIBE, | ||
`local candidate - ${this.subscribeConnection?.selectedCandidatePair?.local.candidate}; remote candidate - ${this.subscribeConnection?.selectedCandidatePair?.remote.candidate}`, | ||
`local candidate - ${this.subscribeConnection?.selectedCandidatePair?.local?.candidate}; remote candidate - ${this.subscribeConnection?.selectedCandidatePair?.remote?.candidate}`, | ||
), | ||
@@ -379,3 +391,3 @@ ); | ||
HMSAction.SUBSCRIBE, | ||
`local candidate - ${this.subscribeConnection?.selectedCandidatePair?.local.candidate}; remote candidate - ${this.subscribeConnection?.selectedCandidatePair?.remote.candidate}`, | ||
`local candidate - ${this.subscribeConnection?.selectedCandidatePair?.local?.candidate}; remote candidate - ${this.subscribeConnection?.selectedCandidatePair?.remote?.candidate}`, | ||
), | ||
@@ -391,2 +403,10 @@ ); | ||
}, | ||
onIceCandidate: candidate => { | ||
this.connectivityListener?.onICECandidate(candidate, false); | ||
}, | ||
onSelectedCandidatePairChange: candidatePair => { | ||
this.connectivityListener?.onSelectedICECandidatePairChange(candidatePair, false); | ||
}, | ||
}; | ||
@@ -404,2 +424,6 @@ | ||
setConnectivityListener(listener: HMSDiagnosticsConnectivityListener) { | ||
this.connectivityListener = listener; | ||
} | ||
async preview( | ||
@@ -563,2 +587,3 @@ token: string, | ||
await this.publishTrack(track); | ||
this.connectivityListener?.onMediaPublished(track); | ||
} catch (error) { | ||
@@ -929,2 +954,3 @@ this.eventBus.analytics.publish( | ||
}); | ||
this.connectivityListener?.onInitSuccess(this.initConfig.endpoint); | ||
const room = this.store.getRoom(); | ||
@@ -943,2 +969,3 @@ if (room) { | ||
this.observer.onConnected(); | ||
this.connectivityListener?.onSignallingSuccess(); | ||
this.store.setSimulcastEnabled(this.isFlagEnabled(InitFlags.FLAG_SERVER_SIMULCAST)); | ||
@@ -1130,3 +1157,3 @@ HMSLogger.d(TAG, 'Adding Analytics Transport: JsonRpcSignal'); | ||
private handleSubscribeConnectionConnected() { | ||
this.subscribeConnection?.logSelectedIceCandidatePairs(); | ||
this.subscribeConnection?.handleSelectedIceCandidatePairs(); | ||
const callback = this.callbacks.get(SUBSCRIBE_ICE_CONNECTION_CALLBACK_ID); | ||
@@ -1133,0 +1160,0 @@ this.callbacks.delete(SUBSCRIBE_ICE_CONNECTION_CALLBACK_ID); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
4645522
550
39655