Closed TimeTravelersHackedMe closed 6 years ago
@TimeTravelersHackedMe I don't know if it makes sense to use this plugin. You might be better off using the HTML Audio API or something like SoundManager 2: http://www.schillmania.com/projects/soundmanager2/
Hey, I have a similar problem. Can I get the duration of the track like in the track-progress-bar in my .ts file ?
@viococo This is just an idea, but you could get a reference to the audio-track
component and use it in the code:
<audio-track #audio *ngFor="let track of myTracks" [track]="track">
...
</audio-track>
Then in your .ts file:
import { Component, ViewChild } from '@angular/core';
import { IAudioTrack } from 'ionic-audio';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild('audio') audioTrack: IAudioTrack;
ngAfterViewInit() {
// get duration from component instance in page
let duration = this.audioTrack.duration;
}
}
I will try it, thanks :)
Hey, I'm trying to use Ionic Audio without using the components. I'm doing this because I want to be able to play audio in the background as the user navigates away from the views where the components would be.
My main problem is I'm not sure how I can tie into the onFinish event, get the track progress, and get the track total time using the AudioProvider.
Here's my code so far:
Anyone know how I can fill in those functions at the bottom and also get access to the onFinish event?