From 4e7335f149a8b3dba56fc174b1d73a6a0e57ceee Mon Sep 17 00:00:00 2001 From: ArmoredDragon <43324896+Armored-Dragon@users.noreply.github.com> Date: Sat, 24 Jun 2023 10:52:41 -0500 Subject: [PATCH 1/4] Attempt 1: Do we need it? --- .gitignore | 2 ++ interface/resources/html/createGlobalEventBridge.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index bbcbadf2b6..c3cb03f201 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,8 @@ local.properties !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json +# Workspace +*.code-workspace # Xcode *.xcodeproj diff --git a/interface/resources/html/createGlobalEventBridge.js b/interface/resources/html/createGlobalEventBridge.js index 11616c051a..43c92ff1e9 100644 --- a/interface/resources/html/createGlobalEventBridge.js +++ b/interface/resources/html/createGlobalEventBridge.js @@ -40,19 +40,19 @@ var EventBridge; window.addEventListener("load",function(event) { setTimeout(function() { - EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); }, 1200); }, false); document.addEventListener("click",function(){ setTimeout(function() { - EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); }, 1200); }, false); document.addEventListener("change",function(){ setTimeout(function() { - EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); }, 1200); }, false); From a986871decd2590f9e3753448a4e62eddcf610e9 Mon Sep 17 00:00:00 2001 From: ArmoredDragon <43324896+Armored-Dragon@users.noreply.github.com> Date: Sat, 24 Jun 2023 11:30:19 -0500 Subject: [PATCH 2/4] Remove document event listeners: No longer needed. --- .../resources/html/createGlobalEventBridge.js | 39 +++++-------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/interface/resources/html/createGlobalEventBridge.js b/interface/resources/html/createGlobalEventBridge.js index 43c92ff1e9..e81d656077 100644 --- a/interface/resources/html/createGlobalEventBridge.js +++ b/interface/resources/html/createGlobalEventBridge.js @@ -1,11 +1,11 @@ // -// createGlobalEventBridge.js +// createGlobalEventBridge.js // -// Created by Anthony J. Thibault on 9/7/2016 -// Copyright 2016 High Fidelity, Inc. +// Created by Anthony J. Thibault on 9/7/2016 +// Copyright 2016 High Fidelity, Inc. // -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // // Stick a EventBridge object in the global namespace. @@ -25,37 +25,16 @@ var EventBridge; this.emitWebEvent = function (message) { self._messages.push(message); }; - }; + } EventBridge = new TempEventBridge(); - var webChannel = new QWebChannel(qt.webChannelTransport, function (channel) { + var webChannel = new QWebChannel(qt.webChannelTransport, (channel) => { + // // replace the TempEventBridge with the real one. var tempEventBridge = EventBridge; EventBridge = channel.objects.eventBridge; - - // To be able to update the state of the output device selection for every element added to the DOM - // we need to listen to events that might precede the addition of this elements. - // A more robust hack will be to add a setInterval that look for DOM changes every 100-300 ms (low performance?) - - window.addEventListener("load",function(event) { - setTimeout(function() { - // EventBridge.forceHtmlAudioOutputDeviceUpdate(); - }, 1200); - }, false); - - document.addEventListener("click",function(){ - setTimeout(function() { - // EventBridge.forceHtmlAudioOutputDeviceUpdate(); - }, 1200); - }, false); - - document.addEventListener("change",function(){ - setTimeout(function() { - // EventBridge.forceHtmlAudioOutputDeviceUpdate(); - }, 1200); - }, false); - + tempEventBridge._callbacks.forEach(function (callback) { EventBridge.scriptEventReceived.connect(callback); }); From 57ab4366d48a7a2ff6cd25ea85e35ad2099a4579 Mon Sep 17 00:00:00 2001 From: ArmoredDragon <43324896+Armored-Dragon@users.noreply.github.com> Date: Sat, 24 Jun 2023 12:09:44 -0500 Subject: [PATCH 3/4] Fixed copyright formatting issues. --- interface/resources/html/createGlobalEventBridge.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/interface/resources/html/createGlobalEventBridge.js b/interface/resources/html/createGlobalEventBridge.js index e81d656077..82881fa222 100644 --- a/interface/resources/html/createGlobalEventBridge.js +++ b/interface/resources/html/createGlobalEventBridge.js @@ -1,11 +1,9 @@ +// Created by Anthony J. Thibault on 9/7/2016 +// Copyright 2016 High Fidelity, Inc. +// Copyright 2023 Overte e.V. // -// createGlobalEventBridge.js -// -// Created by Anthony J. Thibault on 9/7/2016 -// Copyright 2016 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // // Stick a EventBridge object in the global namespace. From de15b30e2d722c2f8c7e28e3273cee73ebddc232 Mon Sep 17 00:00:00 2001 From: Armored-Dragon <43324896+Armored-Dragon@users.noreply.github.com> Date: Sat, 24 Jun 2023 13:27:21 -0500 Subject: [PATCH 4/4] Update createGlobalEventBridge.js Other users seem to be experiencing issues with Audio. Removing it may not be the correct action, instead exposing the API may be the correct action. --- .../resources/html/createGlobalEventBridge.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/interface/resources/html/createGlobalEventBridge.js b/interface/resources/html/createGlobalEventBridge.js index 82881fa222..7fdf700161 100644 --- a/interface/resources/html/createGlobalEventBridge.js +++ b/interface/resources/html/createGlobalEventBridge.js @@ -33,6 +33,30 @@ var EventBridge; var tempEventBridge = EventBridge; EventBridge = channel.objects.eventBridge; + // TODO: These event listeners cause issues. Most likely the function is not being exposed to this scope. This may be causing issues! + + // To be able to update the state of the output device selection for every element added to the DOM + // we need to listen to events that might precede the addition of this elements. + // A more robust hack will be to add a setInterval that look for DOM changes every 100-300 ms (low performance?) + + // window.addEventListener("load",function(event) { + // setTimeout(function() { + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // }, 1200); + // }, false); + + // document.addEventListener("click",function(){ + // setTimeout(function() { + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // }, 1200); + // }, false); + + // document.addEventListener("change",function(){ + // setTimeout(function() { + // EventBridge.forceHtmlAudioOutputDeviceUpdate(); + // }, 1200); + // }, false); + tempEventBridge._callbacks.forEach(function (callback) { EventBridge.scriptEventReceived.connect(callback); });