@livedigital/client 3.23.1 → 3.24.0

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.
@@ -1,5 +1,6 @@
1
1
  import { LogLevel, LogMessageHandler } from '../types/common';
2
2
  import Engine from './index';
3
+ import { InconsistenceType } from './handlers/ChannelStateSyncEventHandler/types';
3
4
  export interface ChannelStateSynchronizerParams {
4
5
  engine: Engine;
5
6
  logLevel: LogLevel;
@@ -8,9 +9,11 @@ export interface ChannelStateSynchronizerParams {
8
9
  }
9
10
  declare class ChannelStateSynchronizer {
10
11
  #private;
11
- readonly debouncedRestoreState: <U>(this: U, ...args: Parameters<() => Promise<void>>) => void;
12
+ readonly debouncedRestoreState: <U>(this: U, ...args: Parameters<() => Promise<void>>) => void | Promise<void>;
13
+ readonly debouncedSyncPeerState: <U>(this: U, type: InconsistenceType) => void | Promise<void>;
12
14
  constructor({ engine, onLogMessage, logLevel, sendAnalytics, }: ChannelStateSynchronizerParams);
13
15
  private watchNetworkState;
16
+ private syncPeerState;
14
17
  private restoreState;
15
18
  private restoreRemoteProducersState;
16
19
  private removeUnnecessaryPeers;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Single point of events handling
3
+ * All events are redirected to that queue
4
+ * And later flushed to subscribed events handlers
5
+ *
6
+ * Has ability to postpone events processing
7
+ *
8
+ * When subscribing to event from all places: sockets, data channels
9
+ * All events should be sent to that queue
10
+ * And handlers should subscribe to events of that queue
11
+ */
12
+ import { DataConsumer } from 'mediasoup-client/lib/DataConsumer';
13
+ import { Socket } from 'socket.io-client';
14
+ export default class EventsQueue {
15
+ #private;
16
+ subscribeToSocket(emmiter: Socket): void;
17
+ subscribeToDataChannel(dataChannel: DataConsumer): void;
18
+ on(event: string, handler: (...args: any[]) => void | Promise<void>): void;
19
+ removeListener(event: string): void;
20
+ removeAllListeners(events: string[], emitter?: Socket): void;
21
+ private push;
22
+ private process;
23
+ private emit;
24
+ pause(): void;
25
+ resume(): void;
26
+ }
@@ -88,6 +88,11 @@ declare class Peer {
88
88
  removeProducePermission(label: TrackLabelString): Promise<void>;
89
89
  getInfo(): Promise<PeerInfo>;
90
90
  getProducers(): PeerProducer[];
91
+ getConsumersState(): {
92
+ id: string;
93
+ producerId: string;
94
+ paused: boolean;
95
+ }[];
91
96
  private handleNewProducer;
92
97
  private handlePeerEvents;
93
98
  reset(): void;
@@ -1,12 +1,16 @@
1
1
  interface ChannelStateConsistencyCheckResultsParams {
2
2
  missingPeers: string[];
3
+ missingConsumers: string[];
3
4
  missingProducers: string[];
5
+ consumersWithInconsistentState: string[];
4
6
  producersWithInconsistentState: string[];
5
7
  peersWithInconsistentAppData: string[];
6
8
  }
7
9
  declare class ChannelStateConsistencyCheckResult {
8
10
  readonly missingPeers: string[];
11
+ readonly missingConsumers: string[];
9
12
  readonly missingProducers: string[];
13
+ readonly consumersWithInconsistentState: string[];
10
14
  readonly producersWithInconsistentState: string[];
11
15
  readonly peersWithInconsistentAppData: string[];
12
16
  constructor(params: ChannelStateConsistencyCheckResultsParams);
@@ -10,16 +10,24 @@ declare class ChannelStateConsistencyChecker {
10
10
  private readonly remoteState;
11
11
  private readonly ignoreIds;
12
12
  private missingPeers;
13
+ private missingConsumers;
13
14
  private missingProducers;
15
+ private consumersWithInconsistentState;
14
16
  private producersWithInconsistentState;
15
17
  private peersWithInconsistentAppData;
16
18
  constructor(params: ChannelStateConsistencyCheckerParams);
17
19
  check(): ChannelStateConsistencyCheckResult;
18
20
  getMissingPeers(): string[];
21
+ /**
22
+ * Contains list of remote producer ids for which local consumer is missing
23
+ */
24
+ getMissingConsumers(): string[];
19
25
  getMissingProducers(): string[];
26
+ getConsumersWithInconsistentState(): string[];
20
27
  getProducersWithInconsistentState(): string[];
21
28
  getPeersWithInconsistentAppData(): string[];
22
29
  private findLocalPeerById;
30
+ private findLocalConsumerByProducerId;
23
31
  private findLocalProducerById;
24
32
  private resetPreviousCheckResults;
25
33
  }
@@ -18,7 +18,9 @@ declare class ChannelStateSyncEventHandler {
18
18
  private rotateLastProbableInconsistencyCheckResults;
19
19
  private isReachedMaxCheckRetries;
20
20
  private getConfirmedMissingPeers;
21
+ private getConfirmedMissingConsumers;
21
22
  private getConfirmedMissingProducers;
23
+ private getConfirmedConsumersWithInconsistencState;
22
24
  private getConfirmedProducersWithInconsistencState;
23
25
  private getConfirmedPeersWithInconsistentAppData;
24
26
  private parseChannelStateSyncEventPayload;
@@ -1,5 +1,8 @@
1
1
  export declare enum InconsistenceType {
2
2
  MissingPeer = "missing-peer",
3
+ MissingConsumers = "missing-consumers",
3
4
  MissingProducer = "missing-producer",
4
- IncorrectProducerState = "incorrect-producer-state"
5
+ IncorrectProducerState = "incorrect-producer-state",
6
+ IncorrectConsumerState = "incorrect-consumer-state"
5
7
  }
8
+ export declare type StorageKey = 'missingPeers' | 'missingConsumers' | 'missingProducers' | 'consumersWithInconsistentState' | 'producersWithInconsistentState' | 'peersWithInconsistentAppData';
@@ -9,6 +9,7 @@ import PeerTrack from './media/tracks/PeerTrack';
9
9
  import { ClientObserverEvents, EngineDependenciesFactory, InternalObserverEvents, IssuesHandler, NetworkScoresUpdatedHandler, NodeActiveStreamsStat } from '../types/engine';
10
10
  import { LoadBalancerApiClientParams } from './network/LoadBalancerClient';
11
11
  import { AudioTrack, BaseTrack, InitEffectsSDKParams, MediaTracksFactory, Track } from '../types/media';
12
+ import EventsQueue from './EventsQueue';
12
13
  declare type EngineParams = {
13
14
  clientEventEmitter: EnhancedEventEmitter;
14
15
  internalEventEmitter: EnhancedEventEmitter;
@@ -34,6 +35,7 @@ declare class Engine {
34
35
  media: Media;
35
36
  clientEventEmitter: EnhancedEventEmitter<ClientObserverEvents>;
36
37
  internalEventEmitter: EnhancedEventEmitter<InternalObserverEvents>;
38
+ eventsQueue: EventsQueue;
37
39
  logLevel: LogLevel;
38
40
  readonly peersRepository: Map<string, Peer>;
39
41
  private channelEventsHandler;