neeeeooooo

neeeeooooo

Hi,

can someone post a simple Froogaloop howto?
Or an example source?

Thanks!

neeeeooooo

neeeeooooo

neeeeooooo

<body>
<iframe id="video" src="player.vimeo.com/video/14239864?title=0&amp;portrait=0&amp;js_api=1"; width="400" height="225" frameborder="0"></iframe>

<script src="js/froogaloop.v1.0.min.js" type="text/javascript" ></script>
<script type="text/javascript" >
var playerIframe = document.getElementById("video");
playerIframe.api("api_play");
playerIframe.addEvent( "onPlay", function(player_id){
alert("play");
});
</script>
</body>

do i something wrong?

Joseph Schmitt

Joseph Schmitt Staff

You need to wait for the player to finish loading before you can interact with it. To do this, add the "onLoad" event like so:

playerIframe.addEvent("onLoad", function() { //put your code in here });

Let me know if that still doesn't work for you. Cheers.

neeeeooooo

neeeeooooo

It still doesn't work! :(

<body>
<iframe id="video" src="player.vimeo.com/video/14239864?title=0&amp;portrait=0&amp;js_api=1"; width="400" height="225" frameborder="0"></iframe>
<script src="js/froogaloop.v1.0.min.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript" >
var iframe = document.getElementById("video");
iframe.addEvent("onLoad", function() {
alert(&#x27;onLoad&#x27;);
iframe.api("api_play");
iframe.api("api_seekTo", 30);
iframe.api("api_setVolume", 10);
});

iframe.addEvent("onPlay", function(player_id){
alert(&#x27;play&#x27;);
});

iframe.addEvent("onSeek", function(time, player_id){
alert(&#x27;seek&#x27;);
});

</script>
</body>

The alert message doesn't appear :(

I tested it with Safari 5, Firefox 3.6.8 and Opera 10.10!

Can you post working example, please?

cheers.

Joseph Schmitt

Joseph Schmitt Staff

Is your example page running locally or on a webserver? The iframe security model doesn't allow postMessage to work locally, so you'll have to point to that file using your localhost instead of opening the html file directly from your hard drive.

David Andrews

David Andrews

Has something changed recently? When I test the github code on localhost I get one of the following:

Firefox 3.6.13 Mac: *sometimes* fires the onLoad event, but even when it does the buttons don't trigger events

Safari 5.0.3 Mac: usually fires the onLoad event the first time, but refreshing (even after clearing the cache) does not trigger it; when the onLoad event happens the buttons work(!)

Chrome 8.0.552.231 Mac: *sometimes* triggers the onLoad event, but when it does the controls don't work

I get the same mostly-broken results using your example page: josephschmitt.net/vimeo/froogaloop.html

Thanks,
Dave

Ethan Smith

Ethan Smith

I've also been confused by this issue in the past two days. All my api calls that worked on universal players last week are now defunct!?

I've been trying to throw every alternate method I can think of at this problem to no avail and am looking forward to hearing your advice!

Thanks,

Ethan

David Andrews

David Andrews

So it appears some progress has been made - the api calls now work, but the "onPlay", "onPause", "onSeek" and "onProgress" events still don't fire. Guess I'll refresh in a few days and see what Vimeo's magic black box has to offer :)

Rich Higgins

Rich Higgins

I'm having problems firing the api, the github example code doesn't seem to work either, unless i'm missing something...

guillaume fradin

guillaume fradin

Hello,
I got the api working on my side with froogaloop, that's really great, thanks for that. Thanks for the very help examples.

But I am stuck with api_getCurrentTime and api_getDuration. I had those working fine with the previous javascript api.

is that because the postMessage does not return any value? Would there be any other way to get those information?

Joseph Schmitt

Joseph Schmitt Staff

It should return a value. Are you calling it via iframeelement.api('apigetCurrentTime'); ?

Joseph Schmitt

Joseph Schmitt Staff

Oh, I see what you mean, and you're absolutely right, it's because postMessage is event-based so a return statement wouldn't work.

Let me look into this further and I'll get back to you on how I'll implement support for this. Thanks for the catch.

guillaume fradin

guillaume fradin

Thanks for letting me know Joseph. I understand it might be a difficult problem, so I can only wish you the best of luck :)

looking forward to embed html5 videos, this will be so much easier to use and manage than flash.

Joseph Schmitt

Joseph Schmitt Staff

Hi there,

I just pushed out an update to support this in Froogaloop. There's a new "get" method you can use for api methods that are getters...

Eg. iframe.get("api_getDuration", function(duration){ //Handle your duration in here });

Make sure to grab the latest Froogaloop from our Github repository (github.com/vimeo/froogaloop), and also let me know if there are any issues.

Best, Joe

Drew Bombard

Drew Bombard

I've been looking around and *think* this might work for me, but I'm not 100% sure.

Before I dig in, let me say that I'm a total nub at this...

Basically, I've got a list of videos on the site that are each being embedded with an iFrame (inside of a Joomla site..). The client does not want 2 or more videos to be playable at once.

Is there a way (without adding and new form buttons or anything) to have any previously playing video pause, if the user then clicks on different Vimeo play button?

Any help would be greatly appreciated.
Thanks
Drew

Brad Dougherty

Brad Dougherty Staff

Yep, you can use the Javascript API to pause a video and you can listen for when another video starts playing.

luke white

luke white

Do you have to use froogaloop? How about if you want to make it so that any other click on the page will pause the video?

luke white

luke white

Is there an embedded example of this function working somewhere for me to inspect?

Daniel Arcé

Daniel Arcé

I've noticed that the script tag pointing to froogaloop in github needs to be at the end of your html markup. Does anyone know why this is? I thought that the $(document).ready function took care of this.
Cheers,
--Daniel.

Brad Dougherty

Brad Dougherty Staff

Hi Jonah,

We have some updates to the player that will fix the API. The updates should be pushed in the next day or two.

robster

robster

hey,

i'm having trouble getting the 'onLoading' event working. the froogaloop example doesn't include use of this.

i'm trying to write some code to play a video clip from 30 seconds in. if i use seekTo and then play too early, before enough of the clip has loaded, then the seek is ignored. what can be done about this?

many thanks for any help :-)

Drew Baker

Drew Baker

Hey Guys,
I'm using the code from "josephschmitt.net/vimeo/froogaloop.html"; and I get this error:

"TypeError: Result of expression 'iframe.addEvent' [undefined] is not a function." error.

Also, the API docs show a different Player ID and API parameter than the one in the readme on github.com/vimeo/froogaloop.

Which is it?
player_id=foo
js_swf_id=foo

js_api=1
api=1

Thanks!

Brad Dougherty

Brad Dougherty Staff

Hi Hilal,

As noted on our documentation page "you'll need to have this running on a web server instead of opening the file directly in your browser. Flash and JS security restrictions will prevent the API from working when run locally."

vimeo.com/api/docs/player-js

This conversation is missing your voice. Please join Vimeo or log in.