@yang__yj/pixelstreaming-core 1.0.1 → 1.0.3

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.
@@ -18,7 +18,6 @@ export declare class Flags {
18
18
  static FakeMouseWithTouches: "FakeMouseWithTouches";
19
19
  static IsQualityController: "ControlsQuality";
20
20
  static MatchViewportResolution: "MatchViewportRes";
21
- static PreferSFU: "preferSFU";
22
21
  static StartVideoMuted: "StartVideoMuted";
23
22
  static SuppressBrowserKeys: "SuppressBrowserKeys";
24
23
  static UseMic: "UseMic";
@@ -27,6 +26,7 @@ export declare class Flags {
27
26
  static TouchInput: "TouchInput";
28
27
  static GamepadInput: "GamepadInput";
29
28
  static XRControllerInput: "XRControllerInput";
29
+ static WaitForStreamer: "WaitForStreamer";
30
30
  }
31
31
  export type FlagsKeys = Exclude<keyof typeof Flags, 'prototype'>;
32
32
  export type FlagsIds = typeof Flags[FlagsKeys];
@@ -42,6 +42,7 @@ export declare class NumericParameters {
42
42
  static WebRTCMinBitrate: "WebRTCMinBitrate";
43
43
  static WebRTCMaxBitrate: "WebRTCMaxBitrate";
44
44
  static MaxReconnectAttempts: "MaxReconnectAttempts";
45
+ static StreamerAutoJoinInterval: "StreamerAutoJoinInterval";
45
46
  }
46
47
  export type NumericParametersKeys = Exclude<keyof typeof NumericParameters, 'prototype'>;
47
48
  export type NumericParametersIds = typeof NumericParameters[NumericParametersKeys];
@@ -136,9 +137,9 @@ export declare class Config {
136
137
  */
137
138
  getSettingOption(id: OptionParametersIds): SettingOption;
138
139
  /**
139
- * Get the value of the configuration flag which has the given id.
140
- * @param id The unique id for the flag.
141
- * @returns True if the flag is enabled.
140
+ * 获取具有给定id的配置标志的值。
141
+ * @param id标志的唯一id
142
+ *如果启用了该标志,@返回True
142
143
  */
143
144
  isFlagEnabled(id: FlagsIds): boolean;
144
145
  /**
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ import { DataChannelLatencyTestRecord, DataChannelLatencyTestRequest, DataChannelLatencyTestResponse, DataChannelLatencyTestResult, DataChannelLatencyTestSeq, DataChannelLatencyTestTimestamp } from "./DataChannelLatencyTestResults";
3
+ export type DataChannelLatencyTestConfig = {
4
+ duration: number;
5
+ rps: number;
6
+ requestSize: number;
7
+ responseSize: number;
8
+ };
9
+ export type DataChannelLatencyTestSink = (request: DataChannelLatencyTestRequest) => void;
10
+ export type DataChannelLatencyTestResultCallback = (result: DataChannelLatencyTestResult) => void;
11
+ export declare class DataChannelLatencyTestController {
12
+ startTime: DataChannelLatencyTestTimestamp;
13
+ sink: DataChannelLatencyTestSink;
14
+ callback: DataChannelLatencyTestResultCallback;
15
+ records: Map<DataChannelLatencyTestSeq, DataChannelLatencyTestRecord>;
16
+ seq: DataChannelLatencyTestSeq;
17
+ interval: NodeJS.Timer;
18
+ constructor(sink: DataChannelLatencyTestSink, callback: DataChannelLatencyTestResultCallback);
19
+ start(config: DataChannelLatencyTestConfig): boolean;
20
+ stop(): void;
21
+ produceResult(): DataChannelLatencyTestResult;
22
+ isRunning(): boolean;
23
+ receive(response: DataChannelLatencyTestResponse): void;
24
+ sendRequest(requestSize: number, responseSize: number): void;
25
+ createRequest(requestSize: number, responseSize: number): DataChannelLatencyTestRequest;
26
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Data Channel Latency Test types
3
+ */
4
+ /**
5
+ * Unix epoch
6
+ */
7
+ export type DataChannelLatencyTestTimestamp = number;
8
+ /**
9
+ * Sequence number represented by unsigned int
10
+ */
11
+ export type DataChannelLatencyTestSeq = number;
12
+ /**
13
+ * Request sent to Streamer
14
+ */
15
+ export type DataChannelLatencyTestRequest = {
16
+ Seq: DataChannelLatencyTestSeq;
17
+ FillResponseSize: number;
18
+ Filler: string;
19
+ };
20
+ /**
21
+ * Response from the Streamer
22
+ */
23
+ export type DataChannelLatencyTestResponse = {
24
+ Seq: DataChannelLatencyTestSeq;
25
+ Filler: string;
26
+ ReceivedTimestamp: DataChannelLatencyTestTimestamp;
27
+ SentTimestamp: DataChannelLatencyTestTimestamp;
28
+ };
29
+ export type DataChannelLatencyTestResult = {
30
+ records: Map<DataChannelLatencyTestSeq, DataChannelLatencyTestRecord>;
31
+ dataChannelRtt: number;
32
+ playerToStreamerTime: number;
33
+ streamerToPlayerTime: number;
34
+ exportLatencyAsCSV: () => string;
35
+ };
36
+ export declare class DataChannelLatencyTestRecord {
37
+ seq: DataChannelLatencyTestSeq;
38
+ playerSentTimestamp: DataChannelLatencyTestTimestamp;
39
+ playerReceivedTimestamp: DataChannelLatencyTestTimestamp;
40
+ streamerReceivedTimestamp: DataChannelLatencyTestTimestamp;
41
+ streamerSentTimestamp: DataChannelLatencyTestTimestamp;
42
+ requestFillerSize: number;
43
+ responseFillerSize: number;
44
+ constructor(request: DataChannelLatencyTestRequest);
45
+ update(response: DataChannelLatencyTestResponse): void;
46
+ }
@@ -29,7 +29,7 @@ export declare class HoveringMouseEvents implements IMouseEvents {
29
29
  */
30
30
  handleMouseUp(mouseEvent: MouseEvent): void;
31
31
  /**
32
- * Handle the mouse context menu event, sends the mouse data to the UE Instance
32
+ * Consumes the mouse context event. The UE instance has no equivalent and doesn't need to be informed.
33
33
  * @param mouseEvent - Mouse Event
34
34
  */
35
35
  handleContextMenu(mouseEvent: MouseEvent): void;
@@ -1,7 +1,7 @@
1
1
  import { Config } from '../Config/Config';
2
2
  import { AggregatedStats } from './AggregatedStats';
3
3
  /**
4
- * Handles the Peer Connection
4
+ * 处理对等连接
5
5
  */
6
6
  export declare class PeerConnectionController {
7
7
  peerConnection: RTCPeerConnection;
@@ -6,6 +6,9 @@ import { InitialSettings } from '../DataChannel/InitialSettings';
6
6
  import { PixelStreamingEvent } from '../Util/EventEmitter';
7
7
  import { MessageOnScreenKeyboard } from '../WebSockets/MessageReceive';
8
8
  import { WebXRController } from '../WebXR/WebXRController';
9
+ import { MessageDirection } from '../UeInstanceMessage/StreamMessageController';
10
+ import { DataChannelLatencyTestConfig, DataChannelLatencyTestController } from "../DataChannel/DataChannelLatencyTestController";
11
+ import { DataChannelLatencyTestResponse } from "../DataChannel/DataChannelLatencyTestResults";
9
12
  export interface PixelStreamingOverrides {
10
13
  /** The DOM elment where Pixel Streaming video and user input event handlers are attached to.
11
14
  * You can give an existing DOM element here. If not given, the library will create a new div element
@@ -22,13 +25,13 @@ export interface PixelStreamingOverrides {
22
25
  export declare class PixelStreaming {
23
26
  protected _webRtcController: WebRtcPlayerController;
24
27
  protected _webXrController: WebXRController;
28
+ protected _dataChannelLatencyTestController: DataChannelLatencyTestController;
25
29
  /**
26
30
  * Configuration object. You can read or modify config through this object. Whenever
27
31
  * the configuration is changed, the library will emit a `settingsChanged` event.
28
32
  */
29
33
  config: Config;
30
34
  private _videoElementParent;
31
- _showActionOrErrorOnDisconnect: boolean;
32
35
  private allowConsoleCommands;
33
36
  private onScreenKeyboardHelper;
34
37
  private _videoStartTime;
@@ -84,6 +87,17 @@ export declare class PixelStreaming {
84
87
  * Auto connect if AutoConnect flag is enabled
85
88
  */
86
89
  private checkForAutoConnect;
90
+ /**
91
+ * Will unmute the microphone track which is sent to Unreal Engine.
92
+ * By default, will only unmute an existing mic track.
93
+ *
94
+ * @param forceEnable Can be used for cases when this object wasn't initialized with a mic track.
95
+ * If this parameter is true, the connection will be restarted with a microphone.
96
+ * Warning: this takes some time, as a full renegotiation and reconnection will happen.
97
+ */
98
+ unmuteMicrophone(forceEnable?: boolean): void;
99
+ muteMicrophone(): void;
100
+ private setMicrophoneMuted;
87
101
  /**
88
102
  * Emit an event on auto connecting
89
103
  */
@@ -99,9 +113,10 @@ export declare class PixelStreaming {
99
113
  /**
100
114
  * Event fired when the video is disconnected - emits given eventString or an override
101
115
  * message from webRtcController if one has been set
102
- * @param eventString - the event text that will be emitted
116
+ * @param eventString - a string describing why the connection closed
117
+ * @param allowClickToReconnect - true if we want to allow the user to retry the connection with a click
103
118
  */
104
- _onDisconnect(eventString: string): void;
119
+ _onDisconnect(eventString: string, allowClickToReconnect: boolean): void;
105
120
  /**
106
121
  * Handles when Web Rtc is connecting
107
122
  */
@@ -123,6 +138,7 @@ export declare class PixelStreaming {
123
138
  * @param latency - latency test results object
124
139
  */
125
140
  _onLatencyTestResult(latencyTimings: LatencyTestResults): void;
141
+ _onDataChannelLatencyTestResponse(response: DataChannelLatencyTestResponse): void;
126
142
  /**
127
143
  * Set up functionality to happen when receiving video statistics
128
144
  * @param videoStats - video statistics as a aggregate stats object
@@ -143,6 +159,7 @@ export declare class PixelStreaming {
143
159
  * @param hasQualityOwnership - does this user have quality ownership of the stream true / false
144
160
  */
145
161
  _onQualityControlOwnership(hasQualityOwnership: boolean): void;
162
+ _onPlayerCount(playerCount: number): void;
146
163
  /**
147
164
  * Request a connection latency test.
148
165
  * NOTE: There are plans to refactor all request* functions. Expect changes if you use this!
@@ -150,7 +167,12 @@ export declare class PixelStreaming {
150
167
  */
151
168
  requestLatencyTest(): boolean;
152
169
  /**
153
- * Request for the UE application to show FPS counter.
170
+ * 请求数据通道延迟测试。
171
+ * 注意:我们计划重构所有的request*函数。如果您使用它,请期待更改!
172
+ */
173
+ requestDataChannelLatencyTest(config: DataChannelLatencyTestConfig): boolean;
174
+ /**
175
+ * 请求UE应用显示FPS计数器
154
176
  * NOTE: There are plans to refactor all request* functions. Expect changes if you use this!
155
177
  * @returns
156
178
  */
@@ -162,8 +184,8 @@ export declare class PixelStreaming {
162
184
  */
163
185
  requestIframe(): boolean;
164
186
  /**
165
- * Send data to UE application. The data will be run through JSON.stringify() so e.g. strings
166
- * and any serializable plain JSON objects with no recurrence can be sent.
187
+ * 发送数据到终端应用。数据将通过JSON.stringify()运行,例如字符串
188
+ * 并且可以发送任何可序列化且没有递归的普通JSON对象。
167
189
  * @returns true if succeeded, false if rejected
168
190
  */
169
191
  emitUIInteraction(descriptor: object | string): boolean;
@@ -231,4 +253,7 @@ export declare class PixelStreaming {
231
253
  * Public getter for the webXrController controller. Used for all XR features.
232
254
  */
233
255
  get webXrController(): WebXRController;
256
+ registerMessageHandler(name: string, direction: MessageDirection, handler?: (data: ArrayBuffer | Array<number | string>) => void): void;
257
+ get toStreamerHandlers(): Map<string, (messageData?: (string | number)[]) => void>;
258
+ isReconnecting(): boolean;
234
259
  }
@@ -14,5 +14,5 @@ export declare class SendMessageController {
14
14
  * @param messageData - the message data we are sending over the data channel
15
15
  * @returns - nil
16
16
  */
17
- sendMessageToStreamer(messageType: string, messageData?: Array<number>): void;
17
+ sendMessageToStreamer(messageType: string, messageData?: Array<number | string>): void;
18
18
  }
@@ -1,14 +1,12 @@
1
- import { TwoWayMap } from './TwoWayMap';
2
1
  export declare class ToStreamerMessage {
3
2
  id: number;
4
- byteLength: number;
5
3
  structure?: Array<string>;
6
4
  }
7
5
  export declare class StreamMessageController {
8
- toStreamerHandlers: Map<string, (messageData?: Array<number> | undefined) => void>;
6
+ toStreamerHandlers: Map<string, (messageData?: Array<number | string> | undefined) => void>;
9
7
  fromStreamerHandlers: Map<string, (messageType: string, messageData?: ArrayBuffer | undefined) => void>;
10
- toStreamerMessages: TwoWayMap<string, ToStreamerMessage>;
11
- fromStreamerMessages: TwoWayMap<string, number>;
8
+ toStreamerMessages: Map<string, ToStreamerMessage>;
9
+ fromStreamerMessages: Map<number, string>;
12
10
  constructor();
13
11
  /**
14
12
  * Populate the Default message protocol
@@ -8,6 +8,7 @@ import { SettingFlag } from '../Config/SettingFlag';
8
8
  import { SettingNumber } from '../Config/SettingNumber';
9
9
  import { SettingText } from '../Config/SettingText';
10
10
  import { SettingOption } from '../Config/SettingOption';
11
+ import { DataChannelLatencyTestResponse, DataChannelLatencyTestResult } from "../DataChannel/DataChannelLatencyTestResults";
11
12
  /**
12
13
  * An event that is emitted when AFK disconnect is about to happen.
13
14
  * Can be cancelled by calling the callback function provided as part of the event.
@@ -102,7 +103,7 @@ export declare class WebRtcDisconnectedEvent extends Event {
102
103
  /** Message describing the disconnect reason */
103
104
  eventString: string;
104
105
  /** true if the user is able to reconnect, false if disconnected because of unrecoverable reasons like not able to connect to the signaling server */
105
- showActionOrErrorOnDisconnect: boolean;
106
+ allowClickToReconnect: boolean;
106
107
  };
107
108
  constructor(data: WebRtcDisconnectedEvent['data']);
108
109
  }
@@ -252,7 +253,9 @@ export declare class StreamerListMessageEvent extends Event {
252
253
  /** Streamer list message containing an array of streamer ids */
253
254
  messageStreamerList: MessageStreamerList;
254
255
  /** Auto-selected streamer from the list, or null if unable to auto-select and user should be prompted to select */
255
- autoSelectedStreamerId: string | null;
256
+ autoSelectedStreamerId: string;
257
+ /** Wanted streamer id from various configurations. */
258
+ wantedStreamerId: string;
256
259
  };
257
260
  constructor(data: StreamerListMessageEvent['data']);
258
261
  }
@@ -267,6 +270,29 @@ export declare class LatencyTestResultEvent extends Event {
267
270
  };
268
271
  constructor(data: LatencyTestResultEvent['data']);
269
272
  }
273
+ /**
274
+ * An event that is emitted when receiving data channel latency test response from server.
275
+ * This event is handled by DataChannelLatencyTestController
276
+ */
277
+ export declare class DataChannelLatencyTestResponseEvent extends Event {
278
+ readonly type: 'dataChannelLatencyTestResponse';
279
+ readonly data: {
280
+ /** Latency test result object */
281
+ response: DataChannelLatencyTestResponse;
282
+ };
283
+ constructor(data: DataChannelLatencyTestResponseEvent['data']);
284
+ }
285
+ /**
286
+ * An event that is emitted when data channel latency test results are ready.
287
+ */
288
+ export declare class DataChannelLatencyTestResultEvent extends Event {
289
+ readonly type: 'dataChannelLatencyTestResult';
290
+ readonly data: {
291
+ /** Latency test result object */
292
+ result: DataChannelLatencyTestResult;
293
+ };
294
+ constructor(data: DataChannelLatencyTestResultEvent['data']);
295
+ }
270
296
  /**
271
297
  * An event that is emitted when receiving initial settings from UE.
272
298
  */
@@ -347,7 +373,18 @@ export declare class XrFrameEvent extends Event {
347
373
  readonly data: XrFrameData;
348
374
  constructor(data: XrFrameEvent['data']);
349
375
  }
350
- export type PixelStreamingEvent = AfkWarningActivateEvent | AfkWarningUpdateEvent | AfkWarningDeactivateEvent | AfkTimedOutEvent | VideoEncoderAvgQPEvent | WebRtcSdpEvent | WebRtcAutoConnectEvent | WebRtcConnectingEvent | WebRtcConnectedEvent | WebRtcFailedEvent | WebRtcDisconnectedEvent | DataChannelOpenEvent | DataChannelCloseEvent | DataChannelErrorEvent | VideoInitializedEvent | StreamLoadingEvent | StreamPreConnectEvent | StreamReconnectEvent | StreamPreDisconnectEvent | PlayStreamErrorEvent | PlayStreamEvent | PlayStreamRejectedEvent | LoadFreezeFrameEvent | HideFreezeFrameEvent | StatsReceivedEvent | StreamerListMessageEvent | LatencyTestResultEvent | InitialSettingsEvent | SettingsChangedEvent | XrSessionStartedEvent | XrSessionEndedEvent | XrFrameEvent;
376
+ /**
377
+ * An event that is emitted when receiving a player count from the signalling server
378
+ */
379
+ export declare class PlayerCountEvent extends Event {
380
+ readonly type: 'playerCount';
381
+ readonly data: {
382
+ /** count object */
383
+ count: number;
384
+ };
385
+ constructor(data: PlayerCountEvent['data']);
386
+ }
387
+ export type PixelStreamingEvent = AfkWarningActivateEvent | AfkWarningUpdateEvent | AfkWarningDeactivateEvent | AfkTimedOutEvent | VideoEncoderAvgQPEvent | WebRtcSdpEvent | WebRtcAutoConnectEvent | WebRtcConnectingEvent | WebRtcConnectedEvent | WebRtcFailedEvent | WebRtcDisconnectedEvent | DataChannelOpenEvent | DataChannelCloseEvent | DataChannelErrorEvent | VideoInitializedEvent | StreamLoadingEvent | StreamPreConnectEvent | StreamReconnectEvent | StreamPreDisconnectEvent | PlayStreamErrorEvent | PlayStreamEvent | PlayStreamRejectedEvent | LoadFreezeFrameEvent | HideFreezeFrameEvent | StatsReceivedEvent | StreamerListMessageEvent | LatencyTestResultEvent | DataChannelLatencyTestResponseEvent | DataChannelLatencyTestResultEvent | InitialSettingsEvent | SettingsChangedEvent | XrSessionStartedEvent | XrSessionEndedEvent | XrFrameEvent | PlayerCountEvent;
351
388
  export declare class EventEmitter extends EventTarget {
352
389
  /**
353
390
  * Dispatch a new event.
@@ -0,0 +1,8 @@
1
+ export declare class RTCUtils {
2
+ static isVideoTransciever(transceiver: RTCRtpTransceiver | undefined): boolean;
3
+ static canTransceiverReceiveVideo(transceiver: RTCRtpTransceiver | undefined): boolean;
4
+ static canTransceiverSendVideo(transceiver: RTCRtpTransceiver | undefined): boolean;
5
+ static isAudioTransciever(transceiver: RTCRtpTransceiver | undefined): boolean;
6
+ static canTransceiverReceiveAudio(transceiver: RTCRtpTransceiver | undefined): boolean;
7
+ static canTransceiverSendAudio(transceiver: RTCRtpTransceiver | undefined): boolean;
8
+ }
@@ -1,7 +1,7 @@
1
1
  import { MouseController } from '../Inputs/MouseController';
2
2
  import { VideoPlayer } from './VideoPlayer';
3
3
  /**
4
- * Video Player Controller handles the creation of the video HTML element and all handlers
4
+ * 视频播放器控制器处理视频HTML元素和所有处理程序的创建
5
5
  */
6
6
  export declare class StreamController {
7
7
  videoElementProvider: VideoPlayer;
@@ -17,8 +17,8 @@ export declare class StreamController {
17
17
  */
18
18
  handleOnTrack(rtcTrackEvent: RTCTrackEvent): void;
19
19
  /**
20
- * Creates the audio device when receiving an RTCTrackEvent with the kind of "audio"
21
- * @param audioMediaStream - Audio Media stream track
20
+ * 当接收到类型为"audio"的RTCTrackEvent时创建音频设备
21
+ * @param audioMediaStream—音频媒体流track
22
22
  */
23
23
  CreateAudioTrack(audioMediaStream: MediaStream): void;
24
24
  }
@@ -13,6 +13,7 @@ declare global {
13
13
  export declare class VideoPlayer {
14
14
  private config;
15
15
  private videoElement;
16
+ private audioElement?;
16
17
  private orientationChangeTimeout;
17
18
  private lastTimeResized;
18
19
  onMatchViewportResolutionCallback: (width: number, height: number) => void;
@@ -23,6 +24,7 @@ export declare class VideoPlayer {
23
24
  * @param config the applications configuration. We're interested in the startVideoMuted flag
24
25
  */
25
26
  constructor(videoElementParent: HTMLElement, config: Config);
27
+ setAudioElement(audioElement: HTMLAudioElement): void;
26
28
  /**
27
29
  * Sets up the video element with any application config and plays the video element.
28
30
  * @returns A promise for if playing the video was successful or not.
@@ -11,10 +11,9 @@ import { Config } from '../Config/Config';
11
11
  import { FileTemplate } from '../Util/FileUtil';
12
12
  import { InputClassesFactory } from '../Inputs/InputClassesFactory';
13
13
  import { VideoPlayer } from '../VideoPlayer/VideoPlayer';
14
- import { StreamMessageController } from '../UeInstanceMessage/StreamMessageController';
14
+ import { StreamMessageController, MessageDirection } from '../UeInstanceMessage/StreamMessageController';
15
15
  import { ResponseController } from '../UeInstanceMessage/ResponseController';
16
16
  import * as MessageReceive from '../WebSockets/MessageReceive';
17
- import { SendDescriptorController } from '../UeInstanceMessage/SendDescriptorController';
18
17
  import { SendMessageController } from '../UeInstanceMessage/SendMessageController';
19
18
  import { ToStreamerMessagesController } from '../UeInstanceMessage/ToStreamerMessagesController';
20
19
  import { MouseController } from '../Inputs/MouseController';
@@ -23,6 +22,7 @@ import { DataChannelSender } from '../DataChannel/DataChannelSender';
23
22
  import { CoordinateConverter, UnquantizedDenormalizedUnsignedCoord } from '../Util/CoordinateConverter';
24
23
  import { PixelStreaming } from '../PixelStreaming/PixelStreaming';
25
24
  import { ITouchController } from '../Inputs/ITouchController';
25
+ import { DataChannelLatencyTestRequest } from '../DataChannel/DataChannelLatencyTestResults';
26
26
  /**
27
27
  * Entry point for the WebRTC Player
28
28
  */
@@ -46,7 +46,6 @@ export declare class WebRtcPlayerController {
46
46
  latencyStartTime: number;
47
47
  pixelStreaming: PixelStreaming;
48
48
  streamMessageController: StreamMessageController;
49
- sendDescriptorController: SendDescriptorController;
50
49
  sendMessageController: SendMessageController;
51
50
  toStreamerMessagesController: ToStreamerMessagesController;
52
51
  keyboardController: KeyboardController;
@@ -61,12 +60,14 @@ export declare class WebRtcPlayerController {
61
60
  preferredCodec: string;
62
61
  peerConfig: RTCConfiguration;
63
62
  videoAvgQp: number;
63
+ locallyClosed: boolean;
64
64
  shouldReconnect: boolean;
65
65
  isReconnecting: boolean;
66
66
  reconnectAttempt: number;
67
- subscribedStream: string | null;
67
+ disconnectMessage: string;
68
+ subscribedStream: string;
68
69
  signallingUrlBuilder: () => string;
69
- disconnectMessageOverride: string;
70
+ autoJoinTimer: ReturnType<typeof setTimeout>;
70
71
  /**
71
72
  *
72
73
  * @param config - the frontend config object
@@ -115,11 +116,11 @@ export declare class WebRtcPlayerController {
115
116
  */
116
117
  setAfkEnabled(afkEnabled: boolean): void;
117
118
  /**
118
- * Restart the stream automatically without refreshing the page
119
+ * 尝试重新连接到信令服务器
119
120
  */
120
- restartStreamAutomatically(): void;
121
+ tryReconnect(message: string): void;
121
122
  /**
122
- * Loads a freeze frame if it is required otherwise shows the play overlay
123
+ * 如果需要,加载一个定格帧,否则显示播放覆盖
123
124
  */
124
125
  loadFreezeFrameOrShowPlayOverlay(): void;
125
126
  /**
@@ -147,7 +148,7 @@ export declare class WebRtcPlayerController {
147
148
  */
148
149
  onFileContents(data: ArrayBuffer): void;
149
150
  /**
150
- * Plays the stream audio and video source and sets up other pieces while the stream starts
151
+ * 播放流音频和视频源,并在流启动时设置其他片段
151
152
  */
152
153
  playStream(): void;
153
154
  /**
@@ -159,7 +160,7 @@ export declare class WebRtcPlayerController {
159
160
  */
160
161
  autoPlayVideoOrSetUpPlayOverlay(): void;
161
162
  /**
162
- * Connect to the Signaling server
163
+ * 连接发信服务器
163
164
  */
164
165
  connectToSignallingServer(): void;
165
166
  /**
@@ -173,16 +174,16 @@ export declare class WebRtcPlayerController {
173
174
  */
174
175
  checkTurnServerAvailability(options: RTCConfiguration): boolean;
175
176
  /**
176
- * Handles when a Config Message is received contains the Peer Connection Options required (STUN and TURN Server Info)
177
- * @param messageConfig - Config Message received from the signaling server
177
+ * 接收到配置消息时的处理包含所需的对等连接选项(STUNTURN服务器信息)
178
+ * @param messageConfig—从发信服务器接收到的配置消息
178
179
  */
179
180
  handleOnConfigMessage(messageConfig: MessageConfig): void;
180
181
  /**
181
- * Handles when the signalling server gives us the list of streamer ids.
182
+ * 当信令服务器给我们streamer id列表时处理。
182
183
  */
183
184
  handleStreamerListMessage(messageStreamerList: MessageStreamerList): void;
184
185
  /**
185
- * Handle the RTC Answer from the signaling server
186
+ * 处理发信服务器的RTC应答
186
187
  * @param Answer - Answer SDP from the peer.
187
188
  */
188
189
  handleWebRtcAnswer(Answer: MessageAnswer): void;
@@ -227,15 +228,15 @@ export declare class WebRtcPlayerController {
227
228
  */
228
229
  setUpMouseAndFreezeFrame(): void;
229
230
  /**
230
- * Close the Connection to the signaling server
231
+ * 关闭到发信服务器的连接
231
232
  */
232
- closeSignalingServer(): void;
233
+ closeSignalingServer(message: string): void;
233
234
  /**
234
- * Close the peer connection
235
+ * 关闭对端连接
235
236
  */
236
237
  closePeerConnection(): void;
237
238
  /**
238
- * Close all connections
239
+ * 关闭所有连接
239
240
  */
240
241
  close(): void;
241
242
  /**
@@ -243,9 +244,13 @@ export declare class WebRtcPlayerController {
243
244
  */
244
245
  getStats(): void;
245
246
  /**
246
- * Send a Latency Test Request to the UE Instance
247
+ * UE实例发送时延测试请求
247
248
  */
248
249
  sendLatencyTest(): void;
250
+ /**
251
+ * Send a Data Channel Latency Test Request to the UE Instance
252
+ */
253
+ sendDataChannelLatencyTest(descriptor: DataChannelLatencyTestRequest): void;
249
254
  /**
250
255
  * Send the MinQP encoder setting to the UE Instance.
251
256
  * @param minQP - The lower bound for QP when encoding
@@ -316,6 +321,11 @@ export declare class WebRtcPlayerController {
316
321
  * @param message - Latency Test Timings
317
322
  */
318
323
  handleLatencyTestResult(message: ArrayBuffer): void;
324
+ /**
325
+ * Handles when a Data Channel Latency Test Response is received from the UE Instance
326
+ * @param message - Data Channel Latency Test Response
327
+ */
328
+ handleDataChannelLatencyTestResponse(message: ArrayBuffer): void;
319
329
  /**
320
330
  * Handles when the Encoder and Web RTC Settings are received from the UE Instance
321
331
  * @param message - Initial Encoder and Web RTC Settings
@@ -344,14 +354,6 @@ export declare class WebRtcPlayerController {
344
354
  * To Resize the Video Player element
345
355
  */
346
356
  resizePlayerStyle(): void;
347
- /**
348
- * Get the overridden disconnect message
349
- */
350
- getDisconnectMessageOverride(): string;
351
- /**
352
- * Set the override for the disconnect message
353
- */
354
- setDisconnectMessageOverride(message: string): void;
355
357
  setPreferredCodec(codec: string): void;
356
358
  setVideoEncoderAvgQP(avgQP: number): void;
357
359
  /**
@@ -371,4 +373,5 @@ export declare class WebRtcPlayerController {
371
373
  */
372
374
  setGamePadInputEnabled(isEnabled: boolean): void;
373
375
  registerDataChannelEventEmitters(dataChannel: DataChannelController): void;
376
+ registerMessageHandler(name: string, direction: MessageDirection, handler?: (data: ArrayBuffer | Array<number | string>) => void): void;
374
377
  }
@@ -13,43 +13,43 @@ export declare enum MessageRecvTypes {
13
13
  WARNING = "warning"
14
14
  }
15
15
  /**
16
- * Concrete Received Message wrapper
16
+ * 具体的接收消息包装器
17
17
  */
18
18
  export declare class MessageRecv {
19
19
  type: string;
20
20
  id: string;
21
21
  }
22
22
  /**
23
- * Authentication Required Message wrapper
23
+ * 身份验证所需的消息包装器
24
24
  */
25
25
  export declare class MessageAuthRequired extends MessageRecv {
26
26
  }
27
27
  /**
28
- * Config Message Wrapper
28
+ * 配置消息包装器
29
29
  */
30
30
  export declare class MessageConfig extends MessageRecv {
31
31
  peerConnectionOptions: RTCConfiguration;
32
32
  }
33
33
  /**
34
- * Streamer List Message Wrapper
34
+ * Streamer列表消息包装器
35
35
  */
36
36
  export declare class MessageStreamerList extends MessageRecv {
37
37
  ids: string[];
38
38
  }
39
39
  /**
40
- * Player Count Message wrapper
40
+ * 玩家计数消息包装器
41
41
  */
42
42
  export declare class MessagePlayerCount extends MessageRecv {
43
43
  count: number;
44
44
  }
45
45
  /**
46
- * Web RTC offer Answer Message wrapper
46
+ * Web RTC提供应答消息包装器
47
47
  */
48
48
  export declare class MessageAnswer extends MessageRecv {
49
49
  sdp: string;
50
50
  }
51
51
  /**
52
- * WebRTC sdp offer Message wrapper.
52
+ * WebRTC sdp提供了消息包装器。
53
53
  */
54
54
  export declare class MessageOffer extends MessageRecv {
55
55
  sdp: string;
@@ -57,13 +57,13 @@ export declare class MessageOffer extends MessageRecv {
57
57
  defaultToHover?: string;
58
58
  }
59
59
  /**
60
- * Ice Candidate Message wrapper
60
+ * Ice候选消息包装器
61
61
  */
62
62
  export declare class MessageIceCandidate extends MessageRecv {
63
63
  candidate: RTCIceCandidateInit;
64
64
  }
65
65
  /**
66
- * Peer Data Channels Message wrapper
66
+ * 对等数据通道消息包装器
67
67
  */
68
68
  export declare class MessagePeerDataChannels extends MessageRecv {
69
69
  recvStreamId: number;