简体   繁体   English

从函数返回的持续时间

[英]Return duration from a function

One of the functions for the vimeo API (with froogaloop) is getDuration(). vimeo API(带有froogaloop)的功能之一是getDuration()。

I am trying to make a function that will return the duration, but somehow I am getting Object as result. 我试图做一个将返回持续时间的函数,但是不知何故我得到了Object作为结果。 The Vimeo API documentation doesn't specify how are you supposed to do this. Vimeo API文档未指定您应该如何执行此操作。

I believe this is incorrect: 我相信这是不正确的:

function getDuration() {
    return player.api('getDuration');
}

Here is an example: 这是一个例子:

http://jsfiddle.net/SeBwt/ http://jsfiddle.net/SeBwt/

getDuration() accepts a callback function that gives you the duration of the media. getDuration()接受一个回调函数,该函数为您提供媒体的持续时间。

For example: 例如:

player.api('getDuration', function(dur) {
    alert(dur);
});

Demo 演示版

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM