ios - Phonegap media stops system music -


phonegap media play method has magic option playaudiowhenscreenislocked = false job:

  1. prevents app music playing when app in background;
  2. makes app music obey hardware "mute" button: without option app ignore if user device muted , play sound anyway.

but there third hidden magic in option. stops current playing song native music app. of it's annoying when want play short single sound.

actually implement scenario:

  1. music: check if system music playing on app start. if not, play app music, otherwise let user enjoy own media.
  2. sound fx: play little sound once , don't spoil anything.
  3. and never play in background , when device muted! if system music app can let so.

has managed similar? thank you.

ended using https://github.com/floatinghotpot/cordova-plugin-nativeaudio (https://build.phonegap.com/plugins/2291)

be aware: simple sound effects not working in simulator.


Comments