mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-07-31 01:09:18 +02:00
pause/play for stream + ip bugfix
This commit is contained in:
@@ -54,12 +54,14 @@ wss.on('connection', (ws, request) => {
|
|||||||
response.on('end', () => {
|
response.on('end', () => {
|
||||||
try {
|
try {
|
||||||
const locationInfo = JSON.parse(data);
|
const locationInfo = JSON.parse(data);
|
||||||
if(locationInfo.country == 'undefined') {
|
console.log(locationInfo.country);
|
||||||
logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]`);
|
if(locationInfo.country === undefined) {
|
||||||
|
logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m`);
|
||||||
|
} else {
|
||||||
|
logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m Location: ${locationInfo.city}, ${locationInfo.region}, ${locationInfo.country}`);
|
||||||
}
|
}
|
||||||
logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}] Location: ${locationInfo.city}, ${locationInfo.region}, ${locationInfo.country}`);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]`);
|
logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -80,6 +80,51 @@ var _3LAS = /** @class */ (function () {
|
|||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
_3LAS.prototype.Stop = function () {
|
||||||
|
try {
|
||||||
|
// Close WebSocket connection
|
||||||
|
if (this.WebSocket) {
|
||||||
|
this.WebSocket.Close();
|
||||||
|
this.WebSocket.OnClose();
|
||||||
|
this.WebSocket = null;
|
||||||
|
this.Logger.Log("WebSocket connection closed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop WakeLock if it exists and is an Android device
|
||||||
|
if (isAndroid && this.WakeLock) {
|
||||||
|
this.WakeLock.End();
|
||||||
|
this.Logger.Log("WakeLock stopped.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset WebRTC if it exists
|
||||||
|
if (this.WebRTC) {
|
||||||
|
this.WebRTC.OnSocketDisconnect();
|
||||||
|
this.WebRTC.Reset();
|
||||||
|
this.WebRTC.Stop();
|
||||||
|
this.Logger.Log("WebRTC reset.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset Fallback if it exists
|
||||||
|
if (this.Fallback) {
|
||||||
|
this.Fallback.OnSocketDisconnect();
|
||||||
|
this.Fallback.Stop();
|
||||||
|
this.Fallback.Reset();
|
||||||
|
this.Logger.Log("Fallback reset.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset connectivity flag
|
||||||
|
if (this.ConnectivityFlag) {
|
||||||
|
this.ConnectivityFlag = null;
|
||||||
|
if (this.ConnectivityCallback) {
|
||||||
|
this.ConnectivityCallback(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Logger.Log("3LAS stopped successfully.");
|
||||||
|
} catch (e) {
|
||||||
|
this.Logger.Log("Error while stopping 3LAS: " + e);
|
||||||
|
}
|
||||||
|
};
|
||||||
_3LAS.prototype.OnActivity = function () {
|
_3LAS.prototype.OnActivity = function () {
|
||||||
if (this.ActivityCallback)
|
if (this.ActivityCallback)
|
||||||
this.ActivityCallback();
|
this.ActivityCallback();
|
||||||
|
|||||||
+8
-7
@@ -34,16 +34,17 @@ function OnConnectivityCallback(isConnected) {
|
|||||||
|
|
||||||
function OnPlayButtonClick(_ev) {
|
function OnPlayButtonClick(_ev) {
|
||||||
try {
|
try {
|
||||||
Stream.Start();
|
if (Stream.ConnectivityFlag) {
|
||||||
$('#playbutton').prop('disabled', true);
|
Stream.Stop();
|
||||||
$('#playbutton').find('.fa-solid').removeClass('fa-play').addClass('fa-pause');
|
$('#playbutton').find('.fa-solid').removeClass('fa-pause').addClass('fa-play');
|
||||||
|
} else {
|
||||||
|
Stream.Start();
|
||||||
|
$('#playbutton').find('.fa-solid').removeClass('fa-play').addClass('fa-pause');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (_ex) {
|
catch (_ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateVolume() {
|
function updateVolume() {
|
||||||
Stream.Volume = $(this).val();
|
Stream.Volume = $(this).val();
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastTapTime = -1;
|
|
||||||
@@ -69,6 +69,11 @@ var WebSocketClient = /** @class */ (function () {
|
|||||||
this.DisconnectCallback();
|
this.DisconnectCallback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
WebSocketClient.prototype.Close = function () {
|
||||||
|
if (this.Socket) {
|
||||||
|
this.Socket.close();
|
||||||
|
}
|
||||||
|
};
|
||||||
// Handle incomping data
|
// Handle incomping data
|
||||||
WebSocketClient.prototype.OnMessage = function (ev) {
|
WebSocketClient.prototype.OnMessage = function (ev) {
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
|
|||||||
Reference in New Issue
Block a user