Thursday, January 19, 2012

[YouTube-API] Change in passed onReady and onStateChange arguments with recent iframe API update?

When I started using the iframe embed API a few weeks ago, I noticed
some apparently undocumented (but helpful) behavior in the onReady and
onStateChange events. This behavior changed somewhat when the iframe
player insertion behavior was altered a couple of days ago (http://
groups.google.com/group/youtube-api-gdata/browse_thread/thread/
cba53817e843603d/1476293b1b119d77#1476293b1b119d77
).

When I log the data that is passed as an argument to my onReady and
onStateChange callbacks, instead of just the player state, as the
documentation suggests, I get a large object in this basic structure
(edited down to the high points):

{
data : 5,
target : a : { ...},
...
d : {
...
duration : 5,
muted : false,
...
videoData : {
title : "My Title",
video_id : "noqHQKqrDrr"
},
...
}
...
}

But, up until iframe insertion changes a couple days ago, I was
getting almost the same thing, but the object "d" was "f" :

{
data : 5,
target : a : { ...},
...
f : {
...
duration : 5,
muted : false,
...
videoData : {
title : "My Title",
video_id : "noqHQKqrDrr"
},
...
}
...
}

The change is minor — no problem there. But, here's why this all
matters: the "target" object is extremely useful in situations where
there is more than one video on a page. It is vital, in that case, for
the callback to know for which video the state is being broadcast.

I realize that this API is still experimental, but it would be good to
get more info on the passed event callback arguments, find out if
there is / will be documentation, and see if there's any feel for this
feature's stability (I hope it sticks around!).

Thanks!

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment