webrtc-streaming-core
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -11,3 +11,3 @@ import { DataChannel } from "./datachannel/datachannel"; | ||
webrtc: WebRTC; | ||
hid: HID; | ||
hid: HID | null; | ||
signaling: SignallingClient; | ||
@@ -14,0 +14,0 @@ datachannels: Map<string, DataChannel>; |
@@ -68,3 +68,5 @@ "use strict"; | ||
this.datachannels.set(a.channel.label, new datachannel_1.DataChannel(a.channel, (data) => { | ||
(0, log_1.Log)(log_1.LogLevel.Debug, `message from data channel ${a.channel.label}: ${data}`); | ||
if (a.channel.label == "hid" && this.hid != null) { | ||
this.hid.handleIncomingData(data); | ||
} | ||
})); | ||
@@ -71,0 +73,0 @@ if (a.channel.label == "hid") { |
export declare class DataChannel { | ||
HID: RTCDataChannel | null; | ||
private channel; | ||
constructor(chan: RTCDataChannel, handler: ((data: string) => (void))); | ||
sendMessage(message: string): void; | ||
} |
@@ -6,7 +6,7 @@ "use strict"; | ||
constructor(chan, handler) { | ||
this.HID = chan; | ||
this.HID.onmessage = ((ev) => { | ||
this.channel = chan; | ||
this.channel.onmessage = ((ev) => { | ||
var _a; | ||
if (ev.data === "ping") { | ||
(_a = this.HID) === null || _a === void 0 ? void 0 : _a.send("ping"); | ||
(_a = this.channel) === null || _a === void 0 ? void 0 : _a.send("ping"); | ||
return; | ||
@@ -16,12 +16,12 @@ } | ||
}); | ||
this.HID.onerror = (() => { | ||
this.channel.onerror = (() => { | ||
}); | ||
this.HID.onclose = (() => { | ||
this.channel.onclose = (() => { | ||
}); | ||
} | ||
sendMessage(message) { | ||
if (this.HID == null) { | ||
if (this.channel == null) { | ||
return; | ||
} | ||
this.HID.send(message); | ||
this.channel.send(message); | ||
} | ||
@@ -28,0 +28,0 @@ } |
@@ -38,2 +38,3 @@ declare class TouchData implements Touch { | ||
disconnectGamepad(event: GamepadEvent): void; | ||
handleIncomingData(data: string): void; | ||
runButton(): void; | ||
@@ -40,0 +41,0 @@ runSlider(): void; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const keys_model_2 = require("../models/keys.model"); | ||
const platform_1 = require("../utils/platform"); | ||
const thresholdTime = 300; | ||
@@ -97,2 +98,7 @@ const thresholdDistance = 10; | ||
window.addEventListener("gamepaddisconnected", this.disconnectGamepad.bind(this)); | ||
if ((0, platform_1.getOS)() == "Android") { | ||
this.SendFunc((new keys_model_2.HIDMsg(keys_model_1.EventCode.GamepadConnect, { | ||
gamepad_id: "0", | ||
}).ToString())); | ||
} | ||
/** | ||
@@ -147,2 +153,15 @@ * mouse lock event | ||
; | ||
handleIncomingData(data) { | ||
const fields = data.split("|"); | ||
switch (fields.at(0)) { | ||
case 'grum': | ||
navigator.getGamepads().forEach((gamepad, gamepad_id) => { | ||
if (gamepad == null) | ||
return; | ||
}); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
runButton() { | ||
@@ -149,0 +168,0 @@ navigator.getGamepads().forEach((gamepad, gamepad_id) => { |
@@ -112,3 +112,3 @@ "use strict"; | ||
// logger.filterEvent(JSON.stringify(level)); | ||
console.log(`${GetLogLevelString(level)}: ${message}`); | ||
// console.log(`${GetLogLevelString(level)}: ${message}`) | ||
} | ||
@@ -115,0 +115,0 @@ exports.Log = Log; |
{ | ||
"name": "webrtc-streaming-core", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"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
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
139618
49
2171