forked from red5pro/red5pro-webrtc-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
1120 lines (1108 loc) · 37.4 KB
/
index.d.ts
File metadata and controls
1120 lines (1108 loc) · 37.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import * as types_playback from 'types/playback';
import { PlaybackState, PlaybackVideoEncoder, PlaybackAudioEncoder } from 'types/playback';
export { PlaybackAudioEncoder, PlaybackState, PlaybackStateReadableMap, PlaybackVideoEncoder } from 'types/playback';
import * as browser_bunyan_lib from 'browser-bunyan/lib';
import { PublishVideoEncoder, PublishAudioEncoder } from 'types/publisher';
export { PublishAudioEncoder, PublishVideoEncoder } from 'types/publisher';
import { Logger } from 'browser-bunyan';
import { Event as Event$1, SubscriberEvent, PublisherEvent, MessageTransportStateEvent } from 'event';
export { Event, MessageTransportStateEvent, PublisherEvent, SubscriberEvent } from 'event';
import EventEmitter$1 from 'core/event-emitter';
import { RTCWhipPublisherConfigType } from 'configuration/publisher';
export { BandwidthConfig, MediaConstraintRange, MediaConstraints, RTCPublisherConfigType, RTCWhipPublisherConfigType, VideoConstraints, defaultWhipPublisherConfig } from 'configuration/publisher';
import { MessageTransport } from 'types/message-transport';
import StatsConfig from 'configuration/stats';
export { default as StatsConfig, defaultStatsConfig } from 'configuration/stats';
import { RTCWhepSubscriberConfigType, HLSSubscriberConfigType } from 'configuration/subscriber';
export { HLSSubscriberConfigType, RTCSubscriberConfigType, RTCWhepSubscriberConfigType, defaultHLSSubscriberConfig, defaultWhepSubscriberConfig } from 'configuration/subscriber';
import WhipWhepSignalingHelper from 'helper/wish-signal-helper';
import { PlaybackView } from 'view/playback';
import RTCPeerConnectionSubscriber from 'helper/peer-connection-sub';
import RTCSubscriberStats from 'stats/subscriber-stats';
import { LiveSeekConfigType } from 'configuration/liveseek';
export { LiveSeekConfigType, LiveSeekOptions, defaultLiveSeekConfig } from 'configuration/liveseek';
import { PublisherEventTypes, SubscriberEventTypes, RTCPublisherEventTypes, RTCSubscriberEventTypes, MessageTransportStateEventTypes } from 'event/event-types';
export { MessageTransportStateEventTypes, PublisherEventTypes, RTCPublisherEventTypes, RTCSubscriberEventTypes, SubscriberEventTypes } from 'event/event-types';
declare const LEVELS: {
readonly TRACE: "trace";
readonly INFO: "info";
readonly DEBUG: "debug";
readonly WARN: "warn";
readonly ERROR: "error";
readonly FATAL: "fatal";
};
/**
* Return the determined logger instance.
*
* @return {Logger} The logger instance.
*
* @private
*/
declare const getLogger: () => Logger;
/**
* Returns the stored logs if requested to `record` on establishment of logger.
*
* @return {string[]} Array of recorded log messages.
*/
declare const getRecordedLogs: () => string[];
/**
* WHIP-based Publisher.
*
* The `WHIPClient` - under the hood - is based on the [WebRTC-HTTP ingestion](https://www.ietf.org/archive/id/draft-ietf-wish-whip-01.html)(WHIP) protocol providing the ability to negotation and establish a connection using HTTP/S requests. This removes the requirement for a WebSocket, which historically has been used for the role of negotiation and connection.
* This provides a standardized - and _blazingly fast_ - way to establish and publish a live stream using WebRTC.
*/
declare class WHIPClient extends EventEmitter$1 {
private _options;
private _peerConnectionHelper;
private _mediaStream;
private _whipWhepService;
private _messageTransport;
private _publishView;
private _statisticsConfiguration;
private _statsMonitor;
/**
* Constructor. Providing arguments will automatically kick of connection sequence.
* Leaving arguments unset allows for more control and follows same pattern of init.
* @param {string} url Optional endpoint for WHIP. Example: https://your-red5pro.com/live/whip/endpoint/stream1
* @param {HTMLMediaElement} element Optional media element to play media in.
* @param {RTCWhipPublisherConfigType} additionalOptions Optional additional options to override defaults.
*/
constructor(url?: string | undefined, element?: HTMLMediaElement | undefined, additionalOptions?: RTCWhipPublisherConfigType | undefined);
private internalInit;
private generateMediaStream;
private getAndPreviewStreamIfAvailable;
private reorderCodecPreferences;
private postOffer;
private postCandidateFragments;
/**
* Initialize the WHIPClient.
*
* @param {RTCWhipPublisherConfigType} options - The options to use for initialization.
* @returns {Promise<WHIPClient>}
*/
init(options: RTCWhipPublisherConfigType): Promise<this>;
/**
* Initialize the WHIPClient with a MediaStream. Doing so will skip the SDK attempting to generate a MediaStream through browser-based media APIs.
*
* @param {RTCWhipPublisherConfigType} options - The options to use for initialization.
* @param {MediaStream} stream - The stream to use for initialization.
* @returns {Promise<WHIPClient>}
*/
initWithStream(options: RTCWhipPublisherConfigType, stream: MediaStream): Promise<this>;
/**
* Publish the MediaStream to the server.
*
* @param {string} streamName - The name of the stream to publish.
* @returns {Promise<WHIPClient>}
*/
publish(streamName?: string | undefined): Promise<this>;
/**
* Unpublish the MediaStream from the server.
*
* @param {boolean} internal - Whether the unpublish is internal (i.e. not triggered by the user).
* @returns {Promise<void>}
*/
unpublish(internal?: boolean): Promise<void>;
/**
* Preview the MediaStream in a HTML media element.
*
* @param mediaStream - The MediaStream to preview.
* @private
*/
preview(mediaStream: MediaStream): void;
/**
* Unpreview the MediaStream from the HTML media element.
*
* @private
*/
unpreview(): void;
/**
* Monitor the statistics of the MediaStream being published to the server over the underlying RTCPeerConnection..
*
* @param {StatsConfig} stats - The statistics configuration.
* @returns {WHIPClient}
*/
monitorStats(stats?: StatsConfig | undefined): WHIPClient;
/**
* Unmonitor the statistics of the MediaStream being published to the server over the underlying RTCPeerConnection.
*
* @returns {WHIPClient}
*/
unmonitorStats(): WHIPClient;
/**
* Mute the audio being published to the server.
*
* @returns {void}
*/
muteAudio(): void;
/**
* Unmute the audio being published to the server.
*
* @returns {void}
*/
unmuteAudio(): void;
/**
* Mute the video being published to the server.
*
* @returns {void}
*/
muteVideo(): void;
/**
* Unmute the video being published to the server.
*
* @returns {void}
*/
unmuteVideo(): void;
/**
* Send a message to the server.
*
* @param {string} methodName - The name of the method to send.
* @param {any} data - The data to send.
* @returns {void}
*/
send(methodName: string, data: any): Promise<boolean> | undefined;
/**
* Call a method on the server.
*
* @param {string} methodName - The name of the method to call.
* @param {any} args - The arguments to call the method with.
* @returns {Promise<any>}
*/
callServer(methodName: string, args: any): Promise<any>;
/**
* Send a log message to the server.
*
* @param {string} level - The level of the log message.
* @param {any} message - The message to send.
*/
sendLog(level: string, message: any): void;
/**
* Get the options for the WHIPClient.
*
* @returns {RTCWhipPublisherConfigType | undefined}
*/
get options(): RTCWhipPublisherConfigType | undefined;
/**
* Get the options for the WHIPClient.
*
* @returns {RTCWhipPublisherConfigType | undefined}
*/
getOptions(): RTCWhipPublisherConfigType | undefined;
/**
* Get the PeerConnection for the WHIPClient.
*
* @returns {RTCPeerConnection | undefined}
*/
getPeerConnection(): RTCPeerConnection | undefined;
/**
* Get the DataChannel for the WHIPClient.
*
* @returns {RTCDataChannel | undefined}
*/
getDataChannel(): RTCDataChannel | undefined;
/**
* Get the MediaStream generated for the WHIPClient.
*
* @returns {MediaStream | undefined}
*/
getMediaStream(): MediaStream | undefined;
/**
* Get the MessageTransport for the WHIPClient.
*
* @returns {MessageTransport | undefined}
*/
getMessageTransport(): MessageTransport | undefined;
private _onDataChannelError;
private _onSendReceived;
private _onMetaData;
private _onConnectionClosed;
private _onDataChannelOpen;
private _onDataChannelClose;
private _onDataChannelMessage;
private _onPeerConnectionTrackAdd;
private _onPeerConnectionOpen;
private _onPeerConnectionFail;
private _onPeerConnectionClose;
private _onIceCandidate;
private _onUnpublish;
private _onPublisherStatus;
private _onInsufficientBandwidth;
private _onSufficientBandwidth;
private _onRecoveringBandwidth;
private _onSDPSuccess;
private _onSDPError;
private _onOrientationChange;
private _onStatisticsEndpointChange;
private _onStatsReport;
/**
* Add an event listener to the WHIPClient.
*
* @param {string} type - The type of event to listen for.
* @param {Function} fn - The function to call when the event is triggered.
*/
on(type: string, fn: (event: Event$1) => void): void;
/**
* Remove an event listener from the WHIPClient.
*
* @param {string} type - The type of event to remove the listener from.
* @param {Function} fn - The function to remove the listener from.
*/
off(type: string, fn: (event: Event$1) => void): void;
/**
* Trigger an event on the WHIPClient.
*
* @param {Event} event - The event to trigger.
*/
trigger(event: Event$1): void;
/**
* Get the type of the WHIPClient (RTC).
*
* @returns {string}
*/
getType(): string;
}
/**
* Base class for a PlaybackControls within the Red5 Pro WebRTC SDK.
* A PlaybackControls is responsible for managing the playback and state of an HTML media element through UI controls.
*/
declare abstract class PlaybackControls extends EventEmitter$1 {
/**
* Enable or disable the playback controls.
*
* @param {boolean} enable - Whether the playback controls are enabled.
* @returns {void}
*/
abstract enable(enable: boolean): void;
/**
* Set the muted state of the media element.
*
* @param {boolean} muted - Whether the media element is muted.
* @returns {void}
*/
abstract setMutedState(muted: boolean): void;
/**
* Get the volume of the media element.
*
* @returns {number}
*/
abstract getVolume(): number;
/**
* Set the volume of the media element.
*
* @param {number} volume - The volume to set.
* @returns {void}
*/
abstract setVolume(volume: number): void;
/**
* Set the seek time of the media element.
*
* @param {number} time - The time to seek to.
* @param {number} duration - The duration of the media element.
* @returns {void}
*/
abstract setSeekTime(time: number, duration?: number): void;
/**
* Set the state of the media element.
*
* @param {PlaybackState} state - The state to set.
* @returns {void}
*/
abstract setState(state: PlaybackState): void;
/**
* Set the VOD state of the media element.
*
* @param {boolean} isVOD - Whether the media element is a VOD.
* @returns {void}
*/
abstract setAsVOD(isVOD: boolean): void;
/**
* Set the playback duration of the media element.
*
* @param {number} duration - The duration to set.
* @returns {void}
*/
abstract setPlaybackDuration(duration: number): void;
/**
* Get the playback duration of the media element.
*
* @returns {number}
*/
abstract getPlaybackDuration(): number;
/**
* Detach the playback controls from the media element.
*
* @returns {void}
*/
abstract detach(): void;
/**
* Trigger an event on the PlaybackControls.
*
* @param {Event} event - The event to trigger.
* @returns {void}
*/
trigger(event: Event$1): void;
/**
* Add an event listener to the PlaybackControls.
*
* @param {string} type - The type of event to listen for.
* @param {Function} fn - The function to call when the event is triggered.
* @returns {void}
*/
on(type: string, fn: (...args: any[]) => void): void;
/**
* Remove an event listener from the PlaybackControls.
*
* @param {string} type - The type of event to remove the listener from.
* @param {Function} fn - The function to remove the listener from.
* @returns {void}
*/
off(type: string, fn: (...args: any[]) => void): void;
}
/**
* Base class for a PlaybackController within the Red5 Pro WebRTC SDK.
* A PlaybackController is responsible for managing the playback and state of a media element.
*/
declare abstract class PlaybackController extends EventEmitter$1 {
/**
* Play the media element.
*
* @param {boolean} fromControls - Whether the play was triggered from the controls.
* @returns {void}
*/
abstract play(fromControls?: boolean): void;
/**
* Pause the media element.
*
* @param {boolean} fromControls - Whether the pause was triggered from the controls.
* @param {boolean} fromSeekAction - Whether the pause was triggered from a seek action.
* @returns {void}
*/
abstract pause(fromControls?: boolean, fromSeekAction?: boolean): void;
/**
* Resume the media element.
*
* @param {boolean} fromControls - Whether the resume was triggered from the controls.
* @param {boolean} fromSeekAction - Whether the resume was triggered from a seek action.
* @returns {void}
*/
abstract resume(fromControls?: boolean, fromSeekAction?: boolean): void;
abstract stop(fromControls?: boolean): void;
/**
* Mute the media element.
*
* @returns {void}
*/
abstract mute(): void;
/**
* Unmute the media element.
*
* @returns {void}
*/
abstract unmute(): void;
/**
* Set the volume of the media element.
*
* @param {number} value - The volume to set.
* @param {boolean} fromControls - Whether the volume was triggered from the controls.
* @returns {void}
*/
abstract setVolume(value: number, fromControls?: boolean): void;
/**
* Get the volume of the media element.
*
* @returns {number}
*/
abstract getVolume(): number;
/**
* Seek to a specific time in the media element.
*
* @param {number} value - The time to seek to.
* @param {number} duration - The duration of the media element.
* @param {boolean} fromControls - Whether the seek was triggered from the controls.
* @returns {void}
*/
abstract seekTo(value: number, duration?: number, fromControls?: boolean): void;
/**
* Toggle the full screen mode of the media element.
*
* @param {HTMLElement} element - The element to toggle the full screen mode of.
* @param {boolean} fromControls - Whether the full screen was triggered from the controls.
* @returns {void}
*/
abstract toggleFullScreen(element?: HTMLElement | undefined, fromControls?: boolean): void;
/**
* Trigger an event on the PlaybackController.
*
* @param {Event} event - The event to trigger.
* @returns {void}
*/
trigger(event: Event$1): void;
/**
* Add an event listener to the PlaybackController.
*
* @param {string} event - The event to listen for.
* @param {Function} fn - The function to call when the event is triggered.
* @returns {void}
*/
on(event: string, fn: (...args: any[]) => void): void;
/**
* Remove an event listener from the PlaybackController.
*
* @param {string} event - The event to remove the listener from.
* @param {Function} fn - The function to remove the listener from.
* @returns {void}
*/
off(event: string, fn: (...args: any[]) => void): void;
}
/**
* Base class for a SourceHandler within the Red5 Pro WebRTC SDK.
* A SourceHandler is responsible for managing the MediaStream source of a media element.
*/
declare abstract class SourceHandler extends PlaybackController {
/**
* Check if the media element is muted.
*
* @returns {boolean}
*/
abstract isMuted(): boolean;
/**
* Get the controls for the media element.
*
* @returns {PlaybackControls | undefined}
*/
abstract getControls(): PlaybackControls | undefined;
/**
* Attempt to autoplay the media element.
*
* @param {boolean} muteOnAutoplay - Whether to mute the media element on autoplay if the browser has a restriction.
* @returns {void}
*/
abstract attemptAutoplay(muteOnAutoplay: boolean): void;
/**
* Unpublish the media element.
*
* @returns {void}
*/
abstract unpublish(): void;
/**
* Disconnect the media element.
*
* @returns {void}
*/
abstract disconnect(): void;
}
/**
* WHEP-based Subscriber.
*
* The `WHEPClient` - under the hood - is based on the [WebRTC-HTTP egress](https://www.ietf.org/archive/id/draft-ietf-wish-whep-03.html)(WHEP) protocol providing the ability to negotation and establish a connection using HTTP/S requests. This removes the requirement for a WebSocket, which historically has been used for the role of negotiation and connection.
* This provides a standardized - and _blazingly fast_ - way to establish and playback a live stream using WebRTC.
*/
declare class WHEPClient extends PlaybackController {
protected _options: RTCWhepSubscriberConfigType | undefined;
protected _peerConnectionHelper: RTCPeerConnectionSubscriber | undefined;
protected _whipWhepService: WhipWhepSignalingHelper | undefined;
protected _messageTransport: MessageTransport | undefined;
protected _playbackView: PlaybackView | undefined;
protected _mediaStream: MediaStream | undefined;
protected _sourceHandler: SourceHandler | undefined;
protected _statisticsConfiguration: StatsConfig | undefined;
protected _statsMonitor: RTCSubscriberStats | undefined;
protected _orientation: number | undefined;
protected _streamingMode: string | undefined;
protected _requestedStreamSwitch: string | undefined;
protected _videoMuted: boolean;
protected _audioMuted: boolean;
protected _videoUnmuteHandler: (event: Event$1) => void;
protected _audioUnmuteHandler: (event: Event$1) => void;
/**
* Constructor for the WHEP-based Subscriber.
*
* @param {string | undefined} url - Optional WHEP endpoint URL for the live stream.
* @param {HTMLMediaElement | undefined} element - Optional HTMLMediaElement to use for live stream playback.
* @param {RTCWhepSubscriberConfigType | undefined} additionalOptions - Optional RTCWhepSubscriberConfigType to use for configuration.
*/
constructor(url?: string | undefined, element?: HTMLMediaElement | undefined, additionalOptions?: RTCWhepSubscriberConfigType | undefined);
private internalInit;
private _runMuteCheck;
private _onVideoUnmute;
private _onAudioUnmute;
protected _attachSourceHandler(view: HTMLMediaElement): void;
protected _glomTrigger(sourceHandler: PlaybackController): void;
protected _playIfAutoplaySet(options: RTCWhepSubscriberConfigType | undefined, view: HTMLMediaElement | undefined): void;
protected addMediaStreamToPlayback(mediaElementId: string, mediaStream: MediaStream): void;
private requestOffer;
private requestAnswer;
private sendAnswer;
private postCandidateFragments;
/**
* Initialize the WHEP-based Subscriber.
*
* @param {RTCWhepSubscriberConfigType} options - RTCWhepSubscriberConfigType to use for configuration.
* @returns {Promise<WHEPClient>}
*/
init(options: RTCWhepSubscriberConfigType): Promise<WHEPClient>;
/**
* Subscribe to the WHEP-based Subscriber.
*
* @returns {Promise<WHEPClient>}
*/
subscribe(): Promise<WHEPClient>;
/**
* Unsubscribe from the WHEP-based Subscriber.
*
* @param {boolean} internal - Optional boolean to indicate if the unsubscribe is internal.
* @returns {Promise<WHEPClient>}
*/
unsubscribe(internal?: boolean): Promise<void>;
/**
* Send a message to the Red5 Pro Server over the message transport (DataChannel).
*
* @param {string} methodName - The method name to send.
* @param {any} data - The data to send.
*/
send(methodName: string, data: any): Promise<boolean> | undefined;
/**
* Call a method on the Red5 Pro Server over the message transport (DataChannel).
*
* @param {string} methodName - The method name to call.
* @param {any} args - The arguments to call the method with.
*/
callServer(methodName: string, args: any): Promise<any>;
/**
* Send a log message to the Red5 Pro Server over the message transport (DataChannel).
*
* @param {string} level - The level of the log message.
* @param {any} message - The message to send.
*/
sendLog(level: string, message: any): void;
/**
* Enable standby mode for the WHEP-based Subscriber. This will signal to the server to hold back audio and video.
*
* @returns {void}
*/
enableStandby(): void;
/**
* Disable standby mode for the WHEP-based Subscriber. This will signal to the server to resume audio and video.
*
* @returns {void}
*/
disableStandby(): void;
/**
* Mute the audio being delivered to the subscriber.
*
* @returns {void}
*/
muteAudio(): void;
/**
* Unmute the audio being delivered to the subscriber.
*
* @returns {void}
*/
unmuteAudio(): void;
/**
* Mute the video being delivered to the subscriber.
*
* @returns {void}
*/
muteVideo(): void;
/**
* Unmute the video being delivered to the subscriber.
*
* @returns {void}
*/
unmuteVideo(): void;
/**
* Get the options for the WHEP-based Subscriber.
*
* @returns {RTCWhepSubscriberConfigType | undefined}
*/
get options(): RTCWhepSubscriberConfigType | undefined;
/**
* Get the options for the WHEP-based Subscriber.
*
* @returns {RTCWhepSubscriberConfigType | undefined}
*/
getOptions(): RTCWhepSubscriberConfigType | undefined;
/**
* Get the peer connection for the WHEP-based Subscriber.
*
* @returns {RTCPeerConnection | undefined}
*/
getPeerConnection(): RTCPeerConnection | undefined;
/**
* Get the data channel for the WHEP-based Subscriber.
*
* @returns {RTCDataChannel | undefined}
*/
getDataChannel(): RTCDataChannel | undefined;
/**
* Get the media stream being played back by the subscriber.
*
* @returns {MediaStream | undefined}
*/
getMediaStream(): MediaStream | undefined;
/**
* Get the message transport for the WHEP-based Subscriber.
*
* @returns {MessageTransport | undefined}
*/
getMessageTransport(): MessageTransport | undefined;
/**
* Get the media element for the WHEP-based Subscriber.
*
* @returns {HTMLMediaElement | undefined}
*/
getPlayer(): HTMLMediaElement | undefined;
/**
* Play the media being delivered to the subscriber.
*
* @returns {void}
*/
play(): void;
/**
* Pause the media being delivered to the subscriber.
*
* @returns {void}
*/
pause(): void;
/**
* Resume the media being delivered to the subscriber.
*
* @returns {void}
*/
resume(): void;
/**
* Stop the media being delivered to the subscriber.
*
* @returns {void}
*/
stop(): void;
/**
* Set the volume of the media being delivered to the subscriber.
*
* @param {number} value - The volume to set.
* @returns {void}
*/
setVolume(value: number): void;
/**
* Get the volume of the media being delivered to the subscriber.
*
* @returns {number}
*/
getVolume(): number;
/**
* Mute the audio playback on the media being delivered to the subscriber.
*
* @returns {void}
*/
mute(): void;
/**
* Unmute the audio playback on the media being delivered to the subscriber.
*
* @returns {void}
*/
unmute(): void;
/**
* Seek to a specific time in the media being delivered to the subscriber.
*
* @param {number} time - The time to seek to.
* @returns {void}
*/
seekTo(time: number): void;
/**
* Toggle the full screen mode of the media being delivered to the subscriber.
*
* @returns {void}
*/
toggleFullScreen(): void;
/**
* Monitor the statistics of the media being delivered to the subscriber over the underlying RTCPeerConnection.
*
* @param {StatsConfig | undefined} stats - The statistics configuration.
* @returns {WHEPClient}
*/
monitorStats(stats?: StatsConfig | undefined): WHEPClient;
/**
* Unmonitor the statistics of the media being delivered to the subscriber over the underlying RTCPeerConnection.
*
* @returns {WHEPClient}
*/
unmonitorStats(): WHEPClient;
protected _onUnpublish(): void;
protected _onStreamUnavailable(receipt: any): void;
protected _onDataChannelError(dataChannel: RTCDataChannel | undefined, errorMessage: string): void;
protected _onSendReceived(methodName: string, data: any): void;
protected _onStreamSwitchComplete(): void;
protected _onMetaData(metadata: any): void;
protected _onConnectionClosed(): void;
protected _onDataChannelOpen(dataChannel: RTCDataChannel): void;
protected _onDataChannelClose(dataChannel: RTCDataChannel): void;
protected _onDataChannelMessage(dataChannel: RTCDataChannel | undefined, message: MessageEvent): void;
protected _onPeerConnectionOpen(): void;
protected _onPeerConnectionFail(): void;
protected _onPeerConnectionClose(event: Event$1): void;
protected _onIceCandidate(candidate: RTCIceCandidate): void;
protected _onPeerConnectionTrackAdd(track: MediaStreamTrack): void;
protected _onSubscriberStatus(data: any): void;
protected _onSDPSuccess(): void;
protected _onSDPError(errorMessage: string): void;
protected _onStatisticsEndpointChange(statisticsEndpoint: string): void;
protected _onStatsReport(connection: RTCPeerConnection, report: any): void;
/**
* Add an event listener to the WHEP-based Subscriber.
*
* @param {string} type - The type of event to listen for.
* @param {Function} fn - The function to call when the event is triggered.
*/
on(type: string, fn: (event: Event$1) => void): void;
/**
* Remove an event listener from the WHEP-based Subscriber.
*
* @param {string} type - The type of event to listen for.
* @param {Function} fn - The function to call when the event is triggered.
*/
off(type: string, fn: (event: Event$1) => void): void;
/**
* Trigger an event on the WHEP-based Subscriber.
*
* @param {Event} event - The event to trigger.
*/
trigger(event: Event$1): void;
/**
* Get the type of the WHEP-based Subscriber (RTC).
*
* @returns {string}
*/
getType(): string;
}
/**
* HLS Subscriber. Supports playback of HLS streams using the native HLS player in browsers that support it (i.e., Mobile and Desktop Safari).
*/
declare class HLSSubscriber extends PlaybackController {
private _options;
private _fileURL;
private _playbackView;
private _sourceHandler;
constructor();
private _glomTrigger;
private _playIfAutoplaySet;
/**
* Initialize the HLS Subscriber.
*
* @param {HLSSubscriberConfigType} options
* @returns {Promise<HLSSubscriber>}
*/
init(options: HLSSubscriberConfigType): Promise<this>;
/**
* Subscribe to the HLS stream.
*
* @returns {Promise<HLSSubscriber>}
*/
subscribe(): Promise<this>;
/**
* Unsubscribe from the HLS stream.
*
* @returns {Promise<HLSSubscriber>}
*/
unsubscribe(): Promise<this>;
/**
* Play the HLS stream.
*
* @returns {void}
*/
play(): void;
/**
* Pause the HLS stream.
*
* @returns {void}
*/
pause(): void;
/**
* Resume the HLS stream.
*
* @returns {void}
*/
resume(): void;
/**
* Stop the HLS stream.
*
* @returns {void}
*/
stop(): void;
/**
* Set the volume of the HLS stream.
*
* @param {number} value
* @returns {void}
*/
setVolume(value: number): void;
/**
* Get the volume of the HLS stream.
*
* @returns {number}
*/
getVolume(): number;
/**
* Mute the HLS stream.
*
* @returns {void}
*/
mute(): void;
/**
* Unmute the HLS stream.
*
* @returns {void}
*/
unmute(): void;
/**
* Seek to a specific time in the HLS stream.
*
* @param {number} time
* @returns {void}
*/
seekTo(time: number): void;
/**
* Toggle the full screen of the HLS stream.
*
* @returns {void}
*/
toggleFullScreen(): void;
/**
* Get the playback element of the HLS stream.
*
* @returns {HTMLMediaElement | undefined}
*/
getPlayer(): HTMLMediaElement | undefined;
/**
* Get the options of the HLS stream.
*
* @returns {HLSSubscriberConfigType | undefined}
*/
get options(): HLSSubscriberConfigType | undefined;
/**
* Get the options of the HLS stream.
*
* @returns {HLSSubscriberConfigType | undefined}
*/
getOptions(): HLSSubscriberConfigType | undefined;
/**
* Get the file URL of the HLS stream.
*
* @returns {string | undefined}
*/
get fileURL(): string | undefined;
/**
* Get the file URL of the HLS stream.
*
* @returns {string | undefined}
*/
getFileURL(): string | undefined;
/**
* Get the type of the subscriber (HLS).
*
* @returns {string}
*/
getType(): string;
}
/**
* WHEP-based Subscriber with Live Seek support.
*/
declare class LiveSeekClient extends WHEPClient {
/**
* Constructor for the WHEP-based Subscriber with Live Seek support.
*
* @param {string | undefined} url - Optional WHEP endpoint URL for the live stream.
* @param {HTMLMediaElement | undefined} element - Optional HTMLMediaElement to use for live stream playback.
* @param {LiveSeekConfigType | undefined} additionalOptions - Optional LiveSeekConfigType to use for configuration.
*/
constructor(url?: string | undefined, element?: HTMLMediaElement | undefined, additionalOptions?: LiveSeekConfigType);
/**
* Initialize the WHEP-based Subscriber with Live Seek support.
*
* @param {LiveSeekConfigType} options - LiveSeekConfigType to use for configuration.
* @returns {Promise<LiveSeekClient>}
*/
init(options: LiveSeekConfigType): Promise<WHEPClient>;
protected _attachSourceHandler(view: HTMLMediaElement): void;
private _enableLiveSeek;
private _startSeekableIfSeekableEnabled;
protected _onUnpublish(): void;
protected _onStreamSwitchComplete(): void;
}
/**
* A base implementation of the SourceHandler class.
*/
declare class SourceHandlerImpl extends SourceHandler {
protected _name: string;
protected _isVOD: boolean;
protected _view: HTMLMediaElement | undefined;
protected _playbackNotificationCenter: any | undefined;
private onCanPlay;
private onDurationChange;
private onEnded;
private onTimeUpdate;
private onPlay;
private onPause;
private onVolumeChange;
private onLoadedData;
private onLoadedMetadata;
private onResize;
private onLoadStart;
private onSuspend;
private onStalled;
private onWaiting;
private onError;
private onEncrypted;
/**
* Constructor for the SourceHandlerImpl class.
*
* @param {HTMLMediaElement} view - The HTML media element to manage.
* @param {string} type - The type of the source handler.
*/
constructor(view: HTMLMediaElement, type: string);
protected _addPlaybackNotificationCenterHandlers(playbackNotificationCenter: any): void;
protected _removePlaybackNotificationCenterHandlers(playbackNotificationCenter: any): void;
protected _handleFullScreenChange(isFullScreen: boolean): void;
protected _cleanup(): void;
protected _onCanPlay(event: Event): void;
protected _onDurationChange(event: Event): void;
protected _onEnded(): void;
protected _onTimeUpdate(event: Event): void;
protected _onPlay(): void;
protected _onPause(): void;
protected _onVolumeChange(event: Event): void;
protected _onLoadedData(event: Event): void;
protected _onLoadedMetadata(event: Event): void;
protected _onResize(event: Event): void;
protected _onLoadStart(): void;
protected _onSuspend(): void;
protected _onStalled(): void;
protected _onWaiting(): void;
protected _onEncrypted(): void;
protected _onError(event: ErrorEvent): void;
attemptAutoplay(muteOnAutoplay?: boolean): Promise<void>;
play(): Promise<boolean>;
pause(): Promise<boolean>;
resume(): Promise<boolean>;
stop(): Promise<boolean>;
mute(): void;
unmute(): void;
setVolume(value: number): void;
getVolume(): number;
seekTo(percentage: number, duration?: undefined): void;