Return duration from a function

风流意气都作罢 提交于 2019-12-24 08:59:26

问题


One of the functions for the vimeo API (with froogaloop) is getDuration().

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.

I believe this is incorrect:

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

Here is an example:

http://jsfiddle.net/SeBwt/


回答1:


getDuration() accepts a callback function that gives you the duration of the media.

For example:

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

Demo



来源:https://stackoverflow.com/questions/16796875/return-duration-from-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!