Skip to content

Commit

Permalink
Only mute media until scene has been loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed May 31, 2023
1 parent 266fd79 commit dbf6bf3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 13 additions & 4 deletions src/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,23 @@ function handleHubChannelJoined(entryManager, hubChannel, messageDispatch, data)

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

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

// Mute media until the scene has been fully loaded.
// We intentionally want voice to be unmuted.
const { globalMediaVolume } = APP.store.state.preferences;
APP.store.update({
preferences: {
globalMediaVolume: 0
}
});
remountUI({
messageDispatch: messageDispatch,
onSendMessage: messageDispatch.dispatch,
onLoaded: () => {
audioSystem.setMasterVolume(1);
APP.store.update({
preferences: {
globalMediaVolume
}
});
store.executeOnLoadActions(scene);
},
onMediaSearchResultEntrySelected: (entry, selectAction) =>
Expand Down
4 changes: 0 additions & 4 deletions src/systems/audio-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ 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 dbf6bf3

Please sign in to comment.