nstudio / nativescript-audio

:microphone: NativeScript plugin to record and play audio :musical_note:
Other
149 stars 104 forks source link

Android: Don't request audio focus on init #188

Closed StevenGBrown closed 3 years ago

StevenGBrown commented 3 years ago

Previously audio focus was requested by the playFromFile method, which is called during initFromFile and initFromUrl. Getting audio focus this early means that when an AUDIOFOCUS_GAIN event is received, the track will start playing even though the caller never requested it to play.

Now the audio focus is not requested until playing the track.

Fixes #111

StevenGBrown commented 3 years ago

OK, I think this is the last of the PRs for now. :-)