phonegap media play
method has magic option playaudiowhenscreenislocked = false
job:
- prevents app music playing when app in background;
- 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:
- music: check if system music playing on app start. if not, play app music, otherwise let user enjoy own media.
- sound fx: play little sound once , don't spoil anything.
- 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
Post a Comment