Feature request: Is there an implementation to connect expo-av to external clients or API like Headphones?

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)
    }

Hey @collinso, we don’t have anything actively planned to add this functionality at the moment. We track feature requests on Canny so I encourage you to head over to our board

Cheers,
Adam

1 Like

Actually i saw it on the canny board. I hope you guys get it done as soon as you can.
https://expo.canny.io/feature-requests/p/audio-playback-in-background

You guys do a good job!