mat-video icon indicating copy to clipboard operation
mat-video copied to clipboard

Expose Video duration

Open Nemolo opened this issue 6 years ago • 2 comments

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?

...

Nemolo avatar Dec 10 '19 16:12 Nemolo

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'));
  }
}

nkoehler avatar Apr 03 '20 21:04 nkoehler

yes this could do, however i still think that exposing the full length of the video could be useful. Thanks!

Nemolo avatar Apr 05 '20 18:04 Nemolo