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

Time event not working

Open Shivampio opened this issue 4 years ago • 1 comments

PLEASE FILL THIS OUT IF YOU WANT HELP WITH AN ISSUE!

Bug, feature request, or proposal:

<mat-video #video [src]="src" title="My Tutorial Title" [(time)]="ctime" [autoplay]="true" [preload]="true" [download]="false" color="accent" spinner="spin">

TS:- ctime = 30;

What is the current behavior?

never stop on time given

What is the expected behavior?

Video need to be paused on selected time

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.
StackBlitz starter: https://goo.gl/wwnhMV

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else I should know?

Shivampio avatar May 04 '20 14:05 Shivampio

For me, the time setting as an output does not work (ok for input). It also doesn't work in the demo.

But I found this great solution :

ngAfterViewInit(): void {
  fromEvent(this.matVideo.getVideoTag(), 'timeupdate')
    .pipe(
      throttleTime(1000),
      map(() => Math.round(this.matVideo.getVideoTag().currentTime)),
      mergeMap(time => this.store.dispatch(new UpdateVideoViewTime(this.lesson._id, this.video._id, time))),
      takeUntil(this.destroy$)
    )
    .subscribe();
}

jboz avatar May 08 '20 13:05 jboz