Skip to content

Commit

Permalink
Don't play audio after the loading screen has been hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed May 23, 2023
1 parent 95c05fd commit 266fd79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,16 @@ function handleHubChannelJoined(entryManager, hubChannel, messageDispatch, data)

console.log(`Dialog host: ${hub.host}:${hub.port}`);

const audioSystem = scene.systems["hubs-systems"].audioSystem;
audioSystem.setMasterVolume(0);

remountUI({
messageDispatch: messageDispatch,
onSendMessage: messageDispatch.dispatch,
onLoaded: () => store.executeOnLoadActions(scene),
onLoaded: () => {
audioSystem.setMasterVolume(1);
store.executeOnLoadActions(scene);
},
onMediaSearchResultEntrySelected: (entry, selectAction) =>
scene.emit("action_selected_media_result_entry", { entry, selectAction }),
onMediaSearchCancelled: entry => scene.emit("action_media_search_cancelled", entry),
Expand Down
4 changes: 4 additions & 0 deletions src/systems/audio-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ export class AudioSystem {
window.APP.store.addEventListener("statechanged", this.onPrefsUpdated);
}

setMasterVolume(vol) {
this._sceneEl.audioListener.setMasterVolume(vol);
}

addStreamToOutboundAudio(id, mediaStream) {
if (this.audioNodes.has(id)) {
this.removeStreamFromOutboundAudio(id);
Expand Down

0 comments on commit 266fd79

Please sign in to comment.