Don’t try to access the MediaPlayer directly in your UI or create another binding. Instead, you can create a command which returning the result of getAudioSessionId():
- Call sendCommand(“getAudioSessionId”, null, myResultReceiver) on the MediaControllerCompat you create from your MediaBrowserCompat’s token.
- In your MediaSessionCompat.Callback, override onCommand(), looking for the getAudioSessionId command and return the value in the Bundle to the ResultReceiver.
- Now your ResultReceiver in your UI has access to the getAudioSessionId() value.