Skip to content

Commit

Permalink
Disable panner node for Android
Browse files Browse the repository at this point in the history
Currently Android seems to have a panner node audio problem.
We already reported it. Until it will be resolved, we force
to disable it as short-term workaround. We disable only for
Android phones because we haven't heard the problem on VR
devices so far.
  • Loading branch information
takahirox committed Apr 11, 2022
1 parent 6d39ba0 commit ac022f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/update-audio-settings.js
Expand Up @@ -5,6 +5,8 @@ import {
AvatarAudioDefaults,
TargetAudioDefaults
} from "./components/audio-params";
import isMobile from "./utils/is-mobile";
import { isAndroid } from "./utils/detect-android";
import { isSafari } from "./utils/detect-safari";

const defaultSettingsForSourceType = Object.freeze(
Expand Down Expand Up @@ -38,6 +40,12 @@ export function getCurrentAudioSettings(el) {
const preferencesOverrides = APP.store.state.preferences.disableLeftRightPanning
? { audioType: AudioType.Stereo }
: {};
// Android has PannerNode audio problem. We already reported it.
// Until it will be fixed, we force to disable panner audio
// as short-term workaround. Disable only for Android phone
// because we haven't heard the problem on VR device so far.
// See #5057
const androidOverrides = isAndroid() && isMobile() ? { audioType: AudioType.Stereo } : {};
const safariOverrides = isSafari() ? { audioType: AudioType.Stereo } : {};
const settings = Object.assign(
{},
Expand All @@ -47,6 +55,7 @@ export function getCurrentAudioSettings(el) {
audioDebugPanelOverrides,
zoneSettings,
preferencesOverrides,
androidOverrides,
safariOverrides
);

Expand Down
6 changes: 6 additions & 0 deletions src/utils/detect-android.js
@@ -0,0 +1,6 @@
import { detect } from "detect-browser";

export function isAndroid() {
const browser = detect();
return ["Android OS"].includes(browser.os);
}

0 comments on commit ac022f7

Please sign in to comment.