title: Angular 5 - Get current time of video
body: <p>I have <strong>HTML5</strong> video in my component and want to get the current video time, while it is playing.</p>
  
  <p>Here is what I've tried and it only gets the time once initially.</p>
  
  <p><strong>Component TS:</strong></p>
  
  <pre><code>export class RegisterComponent implements OnInit, OnChanges {
  
    @ViewChild('videoPlayer')
    private videoPlayer: ElementRef;
  
    constructor() { }
  
    ngOnInit() {
      // only logs once
      console.log(this.videoPlayer.nativeElement.currentTime);
    }
  
    ngOnChanges() {
      // only logs once
      console.log(this.videoPlayer.nativeElement.currentTime);
    }
  }
  </code></pre>
  
  <p><strong>Component HTML:</strong></p>
  
  <pre><code>&lt;video #videoPlayer [autoplay]="true" class="video"&gt;
      &lt;source src="assets/videos/temp.mp4" type="video/mp4"/&gt;
        Browser not supported
  &lt;/video&gt;
  </code></pre>