@100mslive/hms-video-store 0.14.8-alpha.0 → 0.14.8-alpha.2

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.
@@ -10,20 +10,50 @@ export default class HMSSubscribeConnection extends HMSConnection {
10
10
  protected readonly observer: ISubscribeConnectionObserver;
11
11
  private readonly MAX_RETRIES;
12
12
  /**
13
- * The SFU answers within a few ms, but a request sent right as the data channel opens has been
14
- * seen to go unanswered. Without a bound here that caller waits for the rest of the session.
13
+ * Bounds both waits on the api data channel - for it to open, and for a reply. The first request
14
+ * of a session has been seen to go unanswered, and a channel that is closed or replaced never
15
+ * emits 'open' again; unbounded, either leaves that caller waiting for the rest of the session.
16
+ * Deliberately generous: a retry replays the original serialized request, so a premature one can
17
+ * apply stale desired state over a newer request.
15
18
  */
16
19
  private readonly RESPONSE_TIMEOUT;
17
20
  readonly nativeConnection: RTCPeerConnection;
18
21
  private pendingMessageQueue;
22
+ /** `${method}:${track_id}` -> the id of the newest request for it; older ones stop retrying */
23
+ private latestRequestPerState;
24
+ private closed;
25
+ /**
26
+ * Rejectors for the waits currently parked on the api data channel. close() fires them so a
27
+ * leave or an SFU migration settles every pending request at once, rather than each waiting out
28
+ * its RESPONSE_TIMEOUT first - the catch below breaks on `closed`, so it is one timeout per
29
+ * track, but that is still 10s of nothing per tile on every leave.
30
+ */
31
+ private pendingAborts;
19
32
  private apiChannel?;
20
33
  private eventEmitter;
21
34
  private initNativeConnectionCallbacks;
22
35
  constructor(signal: JsonRpcSignal, config: RTCConfiguration, isFlagEnabled: (flag: InitFlags) => boolean, observer: ISubscribeConnectionObserver);
23
36
  sendOverApiDataChannel(message: string): void;
37
+ /**
38
+ * A retry replays the bytes serialised here, so a request still retrying after a newer one has
39
+ * been made for the same track would re-apply state the caller has moved on from. Each request
40
+ * claims its piece of subscription state, and stops once it no longer holds the claim.
41
+ */
24
42
  sendOverApiDataChannelWithResponse<T extends PreferAudioLayerParams | PreferVideoLayerParams>(message: T, requestId?: string): Promise<PreferLayerResponse>;
25
43
  close(): void;
44
+ /**
45
+ * Settles `wait` early if the connection is closed while it is parked on the api data channel.
46
+ * The wait is cancelled rather than just abandoned: eventemitter2 keeps the listener subscribed
47
+ * until its own timeout otherwise, and the emitter is capped at 60.
48
+ */
49
+ private abortOnClose;
26
50
  private handlePendingApiMessages;
27
51
  private sendMessage;
52
+ /**
53
+ * Checked per attempt rather than once up front: 'open' is emitted from the channel's onopen, so
54
+ * a channel that is closed or replaced never emits again and an unbounded wait here would hang
55
+ * the caller for the rest of the session.
56
+ */
57
+ private waitForChannelOpen;
28
58
  private waitForResponse;
29
59
  }
@@ -4,14 +4,14 @@ export interface IAudioOutputManager {
4
4
  getDevice(): MediaDeviceInfo | undefined;
5
5
  setDevice(deviceId: string): Promise<MediaDeviceInfo | undefined>;
6
6
  getVolume(): number;
7
- setVolume(value: number): void;
7
+ setVolume(value: number): Promise<void>;
8
8
  }
9
9
  export declare class AudioOutputManager implements IAudioOutputManager {
10
10
  private deviceManager;
11
11
  private audioSinkManager;
12
12
  constructor(deviceManager: DeviceManager, audioSinkManager: AudioSinkManager);
13
13
  getVolume(): number;
14
- setVolume(value: number): void;
14
+ setVolume(value: number): Promise<void>;
15
15
  getDevice(): MediaDeviceInfo | undefined;
16
16
  setDevice(deviceId?: string): Promise<MediaDeviceInfo | undefined>;
17
17
  unblockAutoplay(): Promise<void>;