webrtc-streaming-core
Advanced tools
Comparing version 1.1.18 to 1.1.19
@@ -27,3 +27,3 @@ import { DataChannel } from "./datachannel/datachannel"; | ||
ChangeBitrate(bitrate: number): void; | ||
ResetVideo(): void; | ||
private ResetVideo; | ||
} |
@@ -45,3 +45,3 @@ "use strict"; | ||
this.video.current.srcObject = evt.streams[0]; | ||
// let pipeline = new Pipeline('h264'); | ||
// let pipeline = new Pipeline('h264'); // TODO | ||
// pipeline.updateSource(evt.streams[0]) | ||
@@ -79,3 +79,3 @@ // pipeline.updateTransform(new WebGLTransform()); | ||
channel.sendMessage(data); | ||
}), this.ResetVideo.bind(this)); | ||
})); | ||
} | ||
@@ -82,0 +82,0 @@ else { |
@@ -0,1 +1,2 @@ | ||
export type AxisType = 'left' | 'right'; | ||
export declare class HID { | ||
@@ -10,29 +11,30 @@ private prev_buttons; | ||
private video; | ||
private SendFunc; | ||
private ResetVideo; | ||
constructor(videoElement: HTMLVideoElement, Sendfunc: ((data: string) => Promise<void>), ResetVideo: (() => Promise<void>)); | ||
private isFullscreen; | ||
connectGamepad(event: GamepadEvent): void; | ||
disconnectGamepad(event: GamepadEvent): void; | ||
SendFunc: ((data: string) => Promise<void>); | ||
constructor(videoElement: HTMLVideoElement, Sendfunc: ((data: string) => Promise<void>)); | ||
isFullscreen(): boolean; | ||
private connectGamepad; | ||
private disconnectGamepad; | ||
handleIncomingData(data: string): void; | ||
runButton(): void; | ||
runSlider(): void; | ||
runAxis(): void; | ||
mouseEnterEvent(event: MouseEvent): void; | ||
mouseLeaveEvent(event: MouseEvent): void; | ||
keydown(event: KeyboardEvent): void; | ||
keyup(event: KeyboardEvent): void; | ||
mouseWheel(event: WheelEvent): void; | ||
mouseButtonMovement(event: MouseEvent): void; | ||
mouseButtonDown(event: MouseEvent): void; | ||
mouseButtonUp(event: MouseEvent): void; | ||
clientToServerY(clientY: number): number; | ||
clientToServerX(clientX: number): number; | ||
elementConfig(VideoElement: HTMLVideoElement): void; | ||
handleStart(evt: TouchEvent): void; | ||
handleMove(evt: TouchEvent): void; | ||
private runButton; | ||
private runSlider; | ||
private runAxis; | ||
VirtualGamepadButtonSlider(released: boolean, index: number): void; | ||
VirtualGamepadAxis(x: number, y: number, type: AxisType): void; | ||
private mouseEnterEvent; | ||
private mouseLeaveEvent; | ||
private keydown; | ||
private keyup; | ||
private mouseWheel; | ||
private mouseButtonMovement; | ||
private mouseButtonDown; | ||
private mouseButtonUp; | ||
private clientToServerY; | ||
private clientToServerX; | ||
private elementConfig; | ||
private handleMove; | ||
private handle_swipe; | ||
handleEnd(evt: TouchEvent): void; | ||
handleCancel(evt: TouchEvent): void; | ||
private handleStart; | ||
private handleEnd; | ||
private handleCancel; | ||
private handle_pinch_zoom; | ||
} |
@@ -79,3 +79,3 @@ "use strict"; | ||
class HID { | ||
constructor(videoElement, Sendfunc, ResetVideo) { | ||
constructor(videoElement, Sendfunc) { | ||
this.prev_buttons = new Map(); | ||
@@ -87,3 +87,2 @@ this.prev_sliders = new Map(); | ||
this.SendFunc = Sendfunc; | ||
this.ResetVideo = ResetVideo; | ||
this.Screen = new Screen(); | ||
@@ -108,3 +107,3 @@ /** | ||
window.addEventListener("gamepaddisconnected", this.disconnectGamepad.bind(this)); | ||
if ((0, platform_1.getOS)() == "Android") { | ||
if ((0, platform_1.getOS)() == "Android" || (0, platform_1.getOS)() == "iOS") { | ||
this.SendFunc((new keys_model_2.HIDMsg(keys_model_1.EventCode.GamepadConnect, { | ||
@@ -114,2 +113,8 @@ gamepad_id: "0", | ||
} | ||
else { | ||
this.video.addEventListener('touchstart', this.handleStart.bind(this)); | ||
this.video.addEventListener('touchend', this.handleEnd.bind(this)); | ||
this.video.addEventListener('touchcancel', this.handleCancel.bind(this)); | ||
this.video.addEventListener('touchmove', this.handleMove.bind(this)); | ||
} | ||
/** | ||
@@ -120,6 +125,2 @@ * mouse lock event | ||
this.video.addEventListener('mouseenter', this.mouseEnterEvent.bind(this)); | ||
this.video.addEventListener('touchstart', this.handleStart.bind(this)); | ||
this.video.addEventListener('touchend', this.handleEnd.bind(this)); | ||
this.video.addEventListener('touchcancel', this.handleCancel.bind(this)); | ||
this.video.addEventListener('touchmove', this.handleMove.bind(this)); | ||
this.shortcuts = new Array(); | ||
@@ -234,2 +235,39 @@ this.shortcuts.push(new keys_model_2.Shortcut(keys_model_2.ShortcutCode.Fullscreen, [keys_model_2.KeyCode.Ctrl, keys_model_2.KeyCode.Shift, keys_model_2.KeyCode.F], (() => { this.video.parentElement.requestFullscreen(); }))); | ||
; | ||
VirtualGamepadButtonSlider(released, index) { | ||
if (index == 6 || index == 7) { // slider | ||
this.SendFunc((new keys_model_2.HIDMsg(keys_model_1.EventCode.GamepadSlide, { | ||
gamepad_id: 0, | ||
index: index, | ||
val: !released ? 1 : 0 | ||
}).ToString())); | ||
return; | ||
} | ||
this.SendFunc((new keys_model_2.HIDMsg(released ? keys_model_1.EventCode.GamepadButtonUp : keys_model_1.EventCode.GamepadButtonDown, { | ||
gamepad_id: 0, | ||
index: index | ||
}).ToString())); | ||
} | ||
VirtualGamepadAxis(x, y, type) { | ||
let axisx, axisy; | ||
switch (type) { | ||
case 'left': | ||
axisx = 0; | ||
axisy = 1; | ||
break; | ||
case 'right': | ||
axisx = 2; | ||
axisy = 3; | ||
break; | ||
} | ||
this.SendFunc((new keys_model_2.HIDMsg(keys_model_1.EventCode.GamepadAxis, { | ||
gamepad_id: 0, | ||
index: axisx, | ||
val: x | ||
}).ToString())); | ||
this.SendFunc((new keys_model_2.HIDMsg(keys_model_1.EventCode.GamepadAxis, { | ||
gamepad_id: 0, | ||
index: axisy, | ||
val: y | ||
}).ToString())); | ||
} | ||
mouseEnterEvent(event) { | ||
@@ -326,17 +364,2 @@ (0, log_1.Log)(log_1.LogLevel.Debug, "Mouse enter"); | ||
} | ||
handleStart(evt) { | ||
evt.preventDefault(); | ||
const touches = evt.changedTouches; | ||
for (let i = 0; i < touches.length; i++) { | ||
let touch = new TouchData(touches[i]); | ||
// hold for left click | ||
touch.holdTimeout = setTimeout(() => { | ||
touch.leftMouseDown = true; | ||
this.SendFunc((new keys_model_2.HIDMsg(keys_model_1.EventCode.MouseDown, { | ||
button: '0' | ||
})).ToString()); | ||
}, 300); | ||
this.onGoingTouchs.set(touches[i].identifier, touch); | ||
} | ||
} | ||
handleMove(evt) { | ||
@@ -413,2 +436,17 @@ evt.preventDefault(); | ||
} | ||
handleStart(evt) { | ||
evt.preventDefault(); | ||
const touches = evt.changedTouches; | ||
for (let i = 0; i < touches.length; i++) { | ||
let touch = new TouchData(touches[i]); | ||
// hold for left click | ||
touch.holdTimeout = setTimeout(() => { | ||
touch.leftMouseDown = true; | ||
this.SendFunc((new keys_model_2.HIDMsg(keys_model_1.EventCode.MouseDown, { | ||
button: '0' | ||
})).ToString()); | ||
}, 300); | ||
this.onGoingTouchs.set(touches[i].identifier, touch); | ||
} | ||
} | ||
handleEnd(evt) { | ||
@@ -464,3 +502,3 @@ evt.preventDefault(); | ||
if (Math.abs(distance.now) > Math.abs(distance.prev) && !this.isFullscreen()) { | ||
this.video.parentElement.requestFullscreen(); | ||
document.documentElement.requestFullscreen(); | ||
} | ||
@@ -467,0 +505,0 @@ // zoom out |
{ | ||
"name": "webrtc-streaming-core", | ||
"version": "1.1.18", | ||
"version": "1.1.19", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/app.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141866
2194