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

Add an onProgress event to the audio track #170

Open KadjoFamian opened 6 years ago

KadjoFamian commented 6 years ago

Hi, I am looking for a way to arbitrary stop the current track. I need a kind of "sample listening". the idea is to be able to stop the music after X second of playing.

Here is an example of how that feature can look

`onProgress(track){

//stop after 30 seconds if(track.progress == 30){ this.audioProvider.tracks[track.id].stop(); } }

`

I guess that it is the same feature used to update the progress bar (time and position).

I could be very interesting to add this.

Thanks for your time

KadjoFamian commented 6 years ago

The event i was looking for is 'ontimeupdate'. I noticed that in "ionic-audio-web-track.ts", all the traditionnal events are implemented. But i don't know how to access them since AudioTrackComponent class provide only one method : "onFinish"

Does anybody know how to listen to web audio traditionnal event ?

any idea will be appreciated, Thanks

ghonche commented 4 years ago

Hi, did you figure out how to get the progress value?