resume video from the place where it stopped in Angular. Below is the code snippet,
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
name = 'Angular 6';
constructor()
{ }
@ViewChild('iframe') iframe: ElementRef;
ngOnInit() {
}
ngAfterViewInit() {
alert('success');
let doc = this.iframe.nativeElement.contentDocument || this.iframe.nativeElement.contentWindow;
if (typeof doc.addEventListener !== undefined) {
doc.addEventListener("click", this.iframeClickHandler, false)
} else if (typeof doc.attachEvent !== undefined) {
doc.attachEvent("onclick", this.iframeClickHandler);
}
}
iframeClickHandler() {
alert("Iframe clicked");
}
}
html
<div>
<iframe width="560" height="315" src="https://player.vimeo.com/video/197933516" frameborder="0" id="iframe" allowfullscreen
#iframe></iframe>
</div>