如何在视频端调用函数? (HTML5和mediaelementjs) [英] How to call a function on video end ? (HTML5 and mediaelementjs)

查看:241
本文介绍了如何在视频端调用函数? (HTML5和mediaelementjs)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 mediaelementjs 在我的网站上播放视频,但我需要拨打一些

i am using mediaelementjs for playing video on my website but i need to call some

在视频结束/暂停时的功能。请告诉我我是怎么做的?

function at the END/pause of video.So please tell me how an i do this?

提前致谢

推荐答案

你需要为结束<创建一个新的 EventListener / code>和暂停事件。

You need to create a new EventListener for the ended and pause events.

示例:

YourMediaElement.addEventListener('ended', function(){
    //Your Code goes here
});

更新:此方法应该应用于创建元素的成功处理程序,如下所示 MediaElementJS.com 页面底部的示例

Update: This method should be applied on the success handler of creating the element, as is shown in the example on the bottom of the page at MediaElementJS.com

success: function (YourMediaElement, domObject) { 

    // add event listener
    YourMediaElement.addEventListener('ended', function(e) {

           //Do Stuff here

    }, false);

这篇关于如何在视频端调用函数? (HTML5和mediaelementjs)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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