小编gue*_*est的帖子

如何从angular2中的函数调用视频暂停事件

这是我的player.component.html

<video width="320" height="240" autoplay autobuffer [src]="videoSrc" (ended)="videoEnd()">
Your browser does not support the video tag.
</video>

<button (click)="pauseOrPlay()">pause/play</button>
Run Code Online (Sandbox Code Playgroud)

在我的player.component.ts中,我有以下函数,当视频结束或单击按钮时调用

videoEnd(event) {
   console.log("video ended");
}

pauseOrPlay(event){
    console.log("button clicked");
    //pause or resume video here
}
Run Code Online (Sandbox Code Playgroud)

我现在想要的是,当单击按钮时,暂停或恢复视频。我可以使用 vid.play() 或 vid.pause() 在 javascript 中执行此操作,但我找不到在 angular2 中执行此操作的方法。任何建议,将不胜感激。

video events typescript angular

2
推荐指数
1
解决办法
4039
查看次数

标签 统计

angular ×1

events ×1

typescript ×1

video ×1