@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.0.11 → 0.1.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.
- package/.cspell.json +35 -0
- package/dist/lib-pixelstreamingfrontend.esm.js +1 -1
- package/dist/lib-pixelstreamingfrontend.js +1 -1
- package/package.json +3 -2
- package/readme.md +1 -1
- package/src/Config/Config.ts +1 -1
- package/src/Inputs/FakeTouchController.ts +1 -1
- package/src/Inputs/GamepadController.ts +2 -2
- package/src/Inputs/IMouseEvents.ts +1 -1
- package/src/Inputs/ITouchController.ts +1 -1
- package/src/Inputs/KeyboardController.ts +2 -2
- package/src/Inputs/LockedMouseEvents.ts +2 -2
- package/src/Inputs/MouseController.ts +1 -1
- package/src/Inputs/TouchController.ts +1 -1
- package/src/Inputs/XRGamepadController.ts +44 -26
- package/src/PeerConnectionController/PeerConnectionController.ts +20 -4
- package/src/PixelStreaming/PixelStreaming.test.ts +34 -51
- package/src/PixelStreaming/PixelStreaming.ts +5 -5
- package/src/Util/CoordinateConverter.ts +6 -5
- package/src/Util/RTCUtils.ts +2 -2
- package/src/VideoPlayer/StreamController.ts +6 -0
- package/src/WebRtcPlayer/WebRtcPlayerController.ts +21 -2
- package/src/WebXR/WebXRController.ts +368 -179
- package/src/__test__/mockWebSocket.ts +5 -5
- package/types/Inputs/GamepadController.d.ts +1 -1
- package/types/Inputs/IMouseEvents.d.ts +1 -1
- package/types/Inputs/ITouchController.d.ts +1 -1
- package/types/Inputs/KeyboardController.d.ts +1 -1
- package/types/Inputs/LockedMouseEvents.d.ts +1 -1
- package/types/Inputs/XRGamepadController.d.ts +8 -1
- package/types/PeerConnectionController/PeerConnectionController.d.ts +2 -0
- package/types/PixelStreaming/PixelStreaming.d.ts +1 -1
- package/types/Util/RTCUtils.d.ts +2 -2
- package/types/WebXR/WebXRController.d.ts +19 -3
- package/src/Util/WebGLUtils.ts +0 -49
- package/src/Util/WebXRUtils.ts +0 -25
- package/types/Util/WebGLUtils.d.ts +0 -4
- package/types/Util/WebXRUtils.d.ts +0 -9
|
@@ -23,7 +23,7 @@ export declare class LockedMouseEvents implements IMouseEvents {
|
|
|
23
23
|
*/
|
|
24
24
|
constructor(videoElementProvider: VideoPlayer, mouseController: MouseController, activeKeysProvider: ActiveKeys);
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Unregister all event handlers.
|
|
27
27
|
*/
|
|
28
28
|
unregisterMouseEvents(): void;
|
|
29
29
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { StreamMessageController } from '../UeInstanceMessage/StreamMessageController';
|
|
3
3
|
import { Controller } from './GamepadTypes';
|
|
4
4
|
/**
|
|
5
|
-
* The class that handles the functionality of
|
|
5
|
+
* The class that handles the functionality of XR gamepads and controllers.
|
|
6
6
|
*/
|
|
7
7
|
export declare class XRGamepadController {
|
|
8
8
|
controllers: Array<Controller>;
|
|
@@ -11,5 +11,12 @@ export declare class XRGamepadController {
|
|
|
11
11
|
* @param toStreamerMessagesProvider - Stream message instance
|
|
12
12
|
*/
|
|
13
13
|
constructor(toStreamerMessagesProvider: StreamMessageController);
|
|
14
|
+
/**
|
|
15
|
+
* Deep copies the values from a gamepad by first converting it to a JSON object and then back to a gamepad
|
|
16
|
+
*
|
|
17
|
+
* @param gamepad the original gamepad
|
|
18
|
+
* @returns a new gamepad object, populated with the original gamepads values
|
|
19
|
+
*/
|
|
20
|
+
static deepCopyGamepad(gamepad: Gamepad): Gamepad;
|
|
14
21
|
updateStatus(source: XRInputSource, frame: XRFrame, refSpace: XRReferenceSpace): void;
|
|
15
22
|
}
|
|
@@ -9,6 +9,8 @@ export declare class PeerConnectionController {
|
|
|
9
9
|
config: Config;
|
|
10
10
|
preferredCodec: string;
|
|
11
11
|
updateCodecSelection: boolean;
|
|
12
|
+
videoTrack: MediaStreamTrack;
|
|
13
|
+
audioTrack: MediaStreamTrack;
|
|
12
14
|
/**
|
|
13
15
|
* Create a new RTC Peer Connection client
|
|
14
16
|
* @param options - Peer connection Options
|
|
@@ -9,7 +9,7 @@ import { MessageDirection } from '../UeInstanceMessage/StreamMessageController';
|
|
|
9
9
|
import { DataChannelLatencyTestConfig, DataChannelLatencyTestController } from "../DataChannel/DataChannelLatencyTestController";
|
|
10
10
|
import { DataChannelLatencyTestResponse } from "../DataChannel/DataChannelLatencyTestResults";
|
|
11
11
|
export interface PixelStreamingOverrides {
|
|
12
|
-
/** The DOM
|
|
12
|
+
/** The DOM element where Pixel Streaming video and user input event handlers are attached to.
|
|
13
13
|
* You can give an existing DOM element here. If not given, the library will create a new div element
|
|
14
14
|
* that is not attached anywhere. In this case you can later get access to this new element and
|
|
15
15
|
* attach it to your web page. */
|
package/types/Util/RTCUtils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare class RTCUtils {
|
|
2
|
-
static
|
|
2
|
+
static isVideoTransceiver(transceiver: RTCRtpTransceiver | undefined): boolean;
|
|
3
3
|
static canTransceiverReceiveVideo(transceiver: RTCRtpTransceiver | undefined): boolean;
|
|
4
4
|
static canTransceiverSendVideo(transceiver: RTCRtpTransceiver | undefined): boolean;
|
|
5
|
-
static
|
|
5
|
+
static isAudioTransceiver(transceiver: RTCRtpTransceiver | undefined): boolean;
|
|
6
6
|
static canTransceiverReceiveAudio(transceiver: RTCRtpTransceiver | undefined): boolean;
|
|
7
7
|
static canTransceiverSendAudio(transceiver: RTCRtpTransceiver | undefined): boolean;
|
|
8
8
|
}
|
|
@@ -4,23 +4,39 @@ export declare class WebXRController {
|
|
|
4
4
|
private xrSession;
|
|
5
5
|
private xrRefSpace;
|
|
6
6
|
private gl;
|
|
7
|
+
private xrViewerPose;
|
|
8
|
+
private EPSILON;
|
|
7
9
|
private positionLocation;
|
|
8
10
|
private texcoordLocation;
|
|
9
|
-
private resolutionLocation;
|
|
10
|
-
private offsetLocation;
|
|
11
11
|
private positionBuffer;
|
|
12
12
|
private texcoordBuffer;
|
|
13
|
+
private videoTexture;
|
|
14
|
+
private prevVideoWidth;
|
|
15
|
+
private prevVideoHeight;
|
|
13
16
|
private webRtcController;
|
|
14
17
|
private xrGamepadController;
|
|
15
|
-
private
|
|
18
|
+
private leftView;
|
|
19
|
+
private rightView;
|
|
20
|
+
private lastSentLeftEyeProj;
|
|
21
|
+
private lastSentRightEyeProj;
|
|
22
|
+
private lastSentRelativeLeftEyePos;
|
|
23
|
+
private lastSentRelativeRightEyePos;
|
|
16
24
|
onSessionStarted: EventTarget;
|
|
17
25
|
onSessionEnded: EventTarget;
|
|
18
26
|
onFrame: EventTarget;
|
|
19
27
|
constructor(webRtcPlayerController: WebRtcPlayerController);
|
|
20
28
|
xrClicked(): void;
|
|
21
29
|
onXrSessionEnded(): void;
|
|
30
|
+
initGL(): void;
|
|
31
|
+
initShaders(): void;
|
|
32
|
+
updateVideoTexture(): void;
|
|
33
|
+
initBuffers(): void;
|
|
22
34
|
onXrSessionStarted(session: XRSession): void;
|
|
35
|
+
areArraysEqual(a: Float32Array, b: Float32Array): boolean;
|
|
36
|
+
arePointsEqual(a: DOMPointReadOnly, b: DOMPointReadOnly): boolean;
|
|
37
|
+
sendXRDataToUE(): void;
|
|
23
38
|
onXrFrame(time: DOMHighResTimeStamp, frame: XRFrame): void;
|
|
39
|
+
private updateViews;
|
|
24
40
|
private render;
|
|
25
41
|
static isSessionSupported(mode: XRSessionMode): Promise<boolean>;
|
|
26
42
|
}
|
package/src/Util/WebGLUtils.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
|
|
3
|
-
export class WebGLUtils {
|
|
4
|
-
static vertexShader(): string {
|
|
5
|
-
return `
|
|
6
|
-
attribute vec2 a_position;
|
|
7
|
-
attribute vec2 a_texCoord;
|
|
8
|
-
|
|
9
|
-
// input
|
|
10
|
-
uniform vec2 u_resolution;
|
|
11
|
-
uniform vec4 u_offset;
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
varying vec2 v_texCoord;
|
|
15
|
-
|
|
16
|
-
void main() {
|
|
17
|
-
// convert the rectangle from pixels to 0.0 to 1.0
|
|
18
|
-
vec2 zeroToOne = a_position / u_resolution;
|
|
19
|
-
|
|
20
|
-
// convert from 0->1 to 0->2
|
|
21
|
-
vec2 zeroToTwo = zeroToOne * 2.0;
|
|
22
|
-
|
|
23
|
-
// convert from 0->2 to -1->+1 (clipspace)
|
|
24
|
-
vec2 clipSpace = zeroToTwo - 1.0;
|
|
25
|
-
|
|
26
|
-
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);
|
|
27
|
-
// pass the texCoord to the fragment shader
|
|
28
|
-
// The GPU will interpolate this value between points.
|
|
29
|
-
v_texCoord = (a_texCoord * u_offset.xy) + u_offset.zw;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static fragmentShader(): string {
|
|
35
|
-
return `
|
|
36
|
-
precision mediump float;
|
|
37
|
-
|
|
38
|
-
// our texture
|
|
39
|
-
uniform sampler2D u_image;
|
|
40
|
-
|
|
41
|
-
// the texCoords passed in from the vertex shader.
|
|
42
|
-
varying vec2 v_texCoord;
|
|
43
|
-
|
|
44
|
-
void main() {
|
|
45
|
-
gl_FragColor = texture2D(u_image, v_texCoord);
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
}
|
package/src/Util/WebXRUtils.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
|
|
3
|
-
export class WebXRUtils {
|
|
4
|
-
/**
|
|
5
|
-
* Deep copies a gamepad's values by first converting it to a JSON object and then back to a gamepad
|
|
6
|
-
*
|
|
7
|
-
* @param gamepad the original gamepad
|
|
8
|
-
* @returns a new gamepad object, populated with the original gamepads values
|
|
9
|
-
*/
|
|
10
|
-
static deepCopyGamepad(gamepad: Gamepad): Gamepad {
|
|
11
|
-
return JSON.parse(
|
|
12
|
-
JSON.stringify({
|
|
13
|
-
buttons: gamepad.buttons.map((b) =>
|
|
14
|
-
JSON.parse(
|
|
15
|
-
JSON.stringify({
|
|
16
|
-
pressed: b.pressed,
|
|
17
|
-
touched: b.touched
|
|
18
|
-
})
|
|
19
|
-
)
|
|
20
|
-
),
|
|
21
|
-
axes: gamepad.axes
|
|
22
|
-
})
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare class WebXRUtils {
|
|
2
|
-
/**
|
|
3
|
-
* Deep copies a gamepad's values by first converting it to a JSON object and then back to a gamepad
|
|
4
|
-
*
|
|
5
|
-
* @param gamepad the original gamepad
|
|
6
|
-
* @returns a new gamepad object, populated with the original gamepads values
|
|
7
|
-
*/
|
|
8
|
-
static deepCopyGamepad(gamepad: Gamepad): Gamepad;
|
|
9
|
-
}
|