mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-08 16:24:13 +02:00
Merge pull request #473 from Armored-Dragon/ForceHtmlAudioOutputDeviceUpdate-fix
ForceHtmlAudioOutputDeviceUpdate fix
This commit is contained in:
commit
ba5c9a2911
2 changed files with 27 additions and 24 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -50,6 +50,8 @@ local.properties
|
|||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
# Workspace
|
||||
*.code-workspace
|
||||
|
||||
# Xcode
|
||||
*.xcodeproj
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
//
|
||||
// createGlobalEventBridge.js
|
||||
//
|
||||
// Created by Anthony J. Thibault on 9/7/2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
@ -25,37 +23,40 @@ 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;
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
// 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);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue