I finished using the expo-av for a project. It was great and i loved it. But there is one more thing to make it perfect. The expo-av does not implement listening to inputs to external clients like Headphones or Car remote controls. Right now, whenever, i play the sounds, i cannot pause/play it with the headphones but i can hear the sound clearly in headphones
Coming from being an Android developer you could do it easily having a class extend the MediaSessionCompacts.Callback to update the ExoPlayer. Am i missing anything?
Is this already implemented in Expo-av? let me know
async function initializeSound(mediaSource){
Audio.setAudioModeAsync(
{
staysActiveInBackground: true, //this alone is good for android
playsInSilentModeIOS: true, //you must set this to ture, if you want the sound to still play when your app goes to the background
}
)
const initialStatus = {
shouldPlay: true, //the sound begins playing immediately when its ready
isLooping: true,
}
const onPlaybackStatusUpdate = async (playbackStatus) => {
if(playbackStatus.isLoaded)
setStatus(() => playbackStatus)
}
const { sound } = await Audio.Sound.createAsync(
mediaSource,
initialStatus,
onPlaybackStatusUpdate,
);
setSound(sound)
}