Reputation: 35
how to get vg-update-time function on videogular2 in angular 5 i using html
<video *ngIf="url" id="video"class="video-js vjs-default-skin vjs-big-play-centered vjs-16-9"controls preload="auto">
<source [src]="url" type="application/x-mpegURL" />
</video>
Upvotes: 1
Views: 678
Reputation: 133
If you are using videogular2, you can track played duration:
onPlayerReady(api: VgAPI) {
this.api = api;
this.api.getDefaultMedia().subscriptions.loadedMetadata.subscribe(
($event) => {
console.log("API " + this.api.duration); // Total duration
});
this.api.getDefaultMedia().subscriptions.timeUpdate.subscribe(
($event) => {
console.log("API current time: ", this.api.currentTime); //current time
});
}
Upvotes: 0
Reputation: 34435
To get updates when the current time changes, you can use the timeUpdate
subscription on the vgApi
api
vgApi.subscriptions.timeUpdate.subscribe(data => {
let currentTime = data.srcElement.currentTime;
});
Upvotes: 2