最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Return duration from a function - Stack Overflow

matteradmin5PV0评论

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:

/

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/SeBwt/

Share Improve this question edited Oct 15, 2013 at 21:47 Jarrod Dixon 15.8k9 gold badges61 silver badges72 bronze badges asked May 28, 2013 at 16:18 scroll_lockscroll_lock 1432 silver badges11 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 9

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

For example:

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

Demo

Post a comment

comment list (0)

  1. No comments so far