angular2 html 5音频播放器ontimeupdate事件 [英] angular2 html 5 audio player ontimeupdate event

查看:48
本文介绍了angular2 html 5音频播放器ontimeupdate事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的角度应用程序,其中集成了音频播放器.

I have a simple angular application that has an audio player integrated.

<audio id="passage-audio" class="passage" controls ontimeupdate="document.getElementById('tracktime').value = this.currentTime ;">
    <source src="Luke.2.1-Luke.2.20.mp3" type="audio/mp3">
    <em class="error"><strong>Error:</strong> Your browser doesn't appear to support HTML5 Audio.</em>
</audio>

音频播放器有一个名为"ontimeupdate"的事件,该事件将更新ID为"tracktime"的html元素中的时间.这很好.

the audio player has an event called "ontimeupdate", this will update the time in the html element with the id "tracktime". This works fine.

我想做的是使用"ontimeupdate"在控制器中调用一个函数.目前,它没有该课程的访问权限.

What i would like to do is to use "ontimeupdate" to invoke a function in the controller. Right now it is not has access to the class.

<audio id="passage-audio" class="passage" controls (ontimeupdate)="updateTime()">...
</audio>

我有办法做到这一点吗?

I there a way to accomplish this?

如果我写了一个音频指令,我将能够访问此事件吗?

If i write an audio directive will i be able to access this event?

谢谢

推荐答案

尝试< audio ...(timeupdate)="updateTime()">

这篇关于angular2 html 5音频播放器ontimeupdate事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆