video html angular
video html angular
by trisna dev
HTML
<video #videoPlayer controls>
<source src="path/to/your/video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<br>
<button (click)="pauseVideo()">Pause Video</button>
TypeScript
import { Component, ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'app-your-component',
templateUrl: './your-component.component.html',
styleUrls: ['./your-component.component.css']
})
export class YourComponent {
@ViewChild('videoPlayer', { static: true }) videoPlayer: ElementRef<HTMLVideoElement>;
pauseVideo() {
this.videoPlayer.nativeElement.pause();
}
}