从函数返回的持续时间 [英] Return duration from a function
本文介绍了从函数返回的持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
vimeo API(带有froogaloop)的功能之一是getDuration().
One of the functions for the vimeo API (with froogaloop) is getDuration().
我正在尝试制作一个将返回持续时间的函数,但是不知何故我得到了Object作为结果. Vimeo API文档未指定您应该如何执行此操作.
I am trying to make a function that will return the duration, but somehow I am getting Object as result. The Vimeo API documentation doesn't specify how are you supposed to do this.
我认为这是不正确的:
function getDuration() {
return player.api('getDuration');
}
这里是一个示例:
推荐答案
getDuration()
接受回调函数,该函数可为您提供媒体播放时间.
getDuration()
accepts a callback function that gives you the duration of the media.
例如:
player.api('getDuration', function(dur) {
alert(dur);
});
Demo
这篇关于从函数返回的持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文