arielfaur / ionic-audio

An audio player for Ionic 3 and Angular 4. Works with HTML 5 audio or native audio using Cordova Media plugin.
http://arielfaur.github.io/ionic-audio/2.0/index.html
MIT License
321 stars 163 forks source link

[ask] how to stop if user go to other menu #172

Closed edwinnsan closed 6 years ago

edwinnsan commented 6 years ago

hello.. i want ask, how to stop audio if user go to other menu / user not in list page of audio how to stop it? Because now its always play on background. Thanks

95deepan commented 6 years ago

Any updates @arielfaur && @edwinnsan ?

edwinnsan commented 6 years ago

Oh this problem already solved, thank you for reminding me @95deepan

95deepan commented 6 years ago

Can you please elaborate how did you solve ? @edwinnsan

edwinnsan commented 6 years ago

you can do it like this

ionViewCanLeave() { this.audioProvider.pause(this.selectedTrack); }

ionviewcanleave is function when we press back button... its backbutton on ionic apps, not in hardware back button..

95deepan commented 6 years ago

Didn't work for me.. because this.selectedTrack whose value is '0'. When I passed this value to this.audioProvider.pause() function, it is not working.

edwinnsan commented 6 years ago

why u passed the value '0'?

this.selectedTrack is like default value from this module, dont replace it, just write the code same with me.

arielfaur commented 6 years ago

Hi all,

I haven't had time to look into all issues lately. And especially this one feature. The plugin might need a small refactor for this to work. I hope I can find the time to look into this sometime soon...

arielfaur commented 6 years ago

140