The τ Player API

setAudioFocus.

setAudioFocus()

focus: parameter possible values are

  • AudioFocus.requestFocus (request focus, but do not do anything special with others App)

  • AudioFocus.requestFocusAndStopOthers (your app will have exclusive use of the output audio)

  • AudioFocus.requestFocusAndDuckOthers (if another App like Spotify use the output audio, its volume will be lowered)

  • AudioFocus.requestFocusAndKeepOthers (your App will play sound above others App)

  • AudioFocus.requestFocusAndInterruptSpokenAudioAndMixWithOthers

  • AudioFocus.requestFocusTransient (for Android)

  • AudioFocus.requestFocusTransientExclusive (for Android)

  • AudioFocus.abandonFocus (Your App will not have anymore the audio focus)

Other parameters :

Please look to openAudioSession() to understand the meaning of the other parameters

Example:

Dart

Javascript


        myPlayer.setAudioFocus(focus: AudioFocus.requestFocusAndDuckOthers);

        Lorem ipsum ...

</div>

Last updated