ionic-audio
ionic-audio copied to clipboard
Listen for play event
Hello
Is it possible for me to listen for the play event? I'm using Ionic 3
There's no play event so far, only the onFinish
event. But it may be a good idea to add it.
What do you need it for?
Hi
Thx for getting back to me. I "need" it for analytics/statistics.
I actually found a way to make it work, but perhaps your event solution would be more elegant.
In the view
<audio-track #track [track]="singleTrack" (onFinish)="onTrackFinished($event)">
<h1 text-center>{{track.title}}</h1>
<ion-item no-padding no-lines [audioTrack]="track">
<ion-thumbnail item-left (click)="trackEvent()">
<audio-track-play light [audioTrack]="track">
<ion-spinner></ion-spinner>
</audio-track-play>
</ion-thumbnail>
</ion-item>
</audio-track>
In the component
trackEvent()
{
let track = this._audioProvider.tracks[this._audioProvider.current];
if ( track )
{
// Doing analytics
}
}
@arielfaur We need it for the same purpose.
@betatools I know it's too old but how did you manage to do this?
Hi @Abhi0725 @betatools This repo is not maintained anymore, I don't have time to commit to this, sorry!