mat-video
mat-video copied to clipboard
Expose Video duration
Feature request:
Expose video duration if relevant (not on streamed video)
What is the current behavior?
it is only possible to seek to a certain time, but not to know the video length.
What is the expected behavior?
To have some access to know the video duration.
What are the steps to reproduce?
N/A
What is the use-case or motivation for changing an existing behavior?
In case of a playlist i want to switch to the next video as soon as the current one finishes.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 8.2 Material 8.2 Windows 10 Typescript 3.5.3
Is there anything else I should know?
...
Would something like this work in the meantime? Change the video when the ended event has triggered.
export class SampleComponent implements OnInit {
@ViewChild('video') matVideo: MatVideoComponent;
video: HTMLVideoElement;
constructor(private renderer: Renderer2) { }
ngOnInit(): void {
this.video = this.matVideo.getVideoTag();
// Use Angular renderer or addEventListener to listen for standard HTML5 video events
this.renderer.listen(this.video, 'ended', () => console.log('video ended'));
this.video.addEventListener('ended', () => console.log('video ended'));
}
}
yes this could do, however i still think that exposing the full length of the video could be useful. Thanks!