Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play sound even when device is silent - iOS #42366

Merged
merged 5 commits into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Expensify.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {Audio} from 'expo-av';
import React, {useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react';
import type {NativeEventSubscription} from 'react-native';
import {AppState, Linking} from 'react-native';
Expand Down Expand Up @@ -206,6 +207,11 @@ function Expensify({
// eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want this effect to run again
}, []);

// This is being done since we want to play sound even when iOS device is on silent mode, to align with other platforms.
useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment that we have to override this setting to allow playing music in silent mode and align with behavior on android and other platforms

Audio.setAudioModeAsync({playsInSilentModeIOS: true});
}, []);

// Display a blank page until the onyx migration completes
if (!isOnyxMigrated) {
return null;
Expand Down
Loading