Update interruption mode imports

This commit is contained in:
Bill Thornton 2022-11-29 11:17:40 -05:00
parent 5e55d29ce6
commit b9af4c4641
2 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Audio } from 'expo-av';
import { Audio, InterruptionModeAndroid, InterruptionModeIOS } from 'expo-av';
import { observer } from 'mobx-react-lite';
import React, { useEffect, useState } from 'react';
@ -21,10 +21,10 @@ const AudioPlayer = observer(() => {
useEffect(() => {
Audio.setAudioModeAsync({
staysActiveInBackground: true,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
interruptionModeAndroid: InterruptionModeAndroid.DoNotMix,
playThroughEarpieceAndroid: false,
shouldDuckAndroid: true,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
interruptionModeIOS: InterruptionModeIOS.DoNotMix,
playsInSilentModeIOS: true
});

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Audio, Video } from 'expo-av';
import { Audio, InterruptionModeAndroid, InterruptionModeIOS, Video } from 'expo-av';
import { observer } from 'mobx-react-lite';
import React, { useEffect, useRef, useState } from 'react';
import { Alert } from 'react-native';
@ -23,8 +23,8 @@ const VideoPlayer = observer(() => {
// Set the audio mode when the video player is created
useEffect(() => {
Audio.setAudioModeAsync({
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
interruptionModeAndroid: InterruptionModeAndroid.DoNotMix,
interruptionModeIOS: InterruptionModeIOS.DoNotMix,
playsInSilentModeIOS: true
});
}, []);