Monday, January 16, 2012

[YouTube-API] Re: onStateChange not firing in Chrome 16

That is correct.
This used to work without specifying a player version:
addEventListener("onStateChange","adytt.pl['"+a+"'].st")

After January 11, 2012 around 6:00PM (which is when we stopped getting
tracking data from that callback) that no longer works.

Both workarounds you listed fix the issue (removing the quotes around
the function, or specifying version=3)

On Jan 13, 4:50 pm, Jeffrey Posnick <je...@google.com> wrote:
> Hello,
>
>  Can you confirm that what you're saying is that when something like
> "myObject.method" is passed in as a string, that no longer works with
> the default embedded player version, but does work with version=3. And
> passing in myObject.method (assuming that resolves to a function
> reference) works in both versions of the embedded player.
>
>  Since there's a numer of ways of working around this issue (moving to
> version=3, which you should do anyway, or passing in the callback as a
> function reference instead of a string), I'd recommend that anyone
> else affected implements one of those workarounds while I wait to get
> confirmation from the original poster that I understand the issue
> correctly, and then ask the Players team about it.
>
> Cheers,
> -Jeff Posnick, YouTube API Team
> groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
> @YouTubeDev
>
> On Jan 13, 5:34 pm, RagingPacifist <mohicanl...@gmail.com> wrote:
>
>
>
>
>
>
>
> > That's an excellent point Jeff, thanks for the tip about parsing the
> > youtube video urls.
> > For now I've removed the &nomobile parameter, it doesn't look like
> > it's needed anyway.
> > I'm still getting the same error, but for me Chrome just throws the
> > error  "Uncaught
> > SyntaxError: Unexpected token ILLEGAL" in the console, but I don't get
> > any indication what line or what file is causing the issue. Through
> > trial and error I found that commenting out line 331 of scode.js on
> > the page removed the error, and from there I found that if the
> > callback parameter includes a . (e.g. adytt.pl['"+a+"'].st ) it throws
> > the error, but if I pass in a global method (e.g. Alert) I get no
> > error and the callback gets made.
> > And as I stated previously, forcing the player to use version=3
> > results in no errors either way.
>
> > On Jan 13, 1:11 pm, Jeffrey Posnick <je...@google.com> wrote:
>
> > > Hello,
>
> > >  When I visithttp://www.thegreatrecovery.com/liveandstartplayback
> > > in Chrome, I do see an error in the console stating "Uncaught
> > > SyntaxError: Unexpected token ILLEGAL". It identifies the source of
> > > that error as youtube_video_helper.js line 5, which is
>
> > >   ytplayer.loadVideoById(this.href.split('?')[1].split('=')[1]);
>
> > > If you evaluate this.href.split('?')[1].split('=')[1] in the JS
> > > console (or just look at the href attribute of that <a> element)
> > > you'll see that it evaluates to "JKohvK4dqW0&nomobile", which isn't a
> > > valid YouTube video id. You need to be a bit more careful in how
> > > you're parsing a YouTube video id out of a YouTube watch page URL, as
> > > you're not accounting for other parameters that might be present.
>
> > >  So while there might be some underlying problem with the Player API
> > > itself, you'd really need to fix that basic problem with your code
> > > first and try again before it illustrates anything definitive.
>
> > > Cheers,
> > > -Jeff Posnick, YouTube API Team
> > > groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
> > > @YouTubeDev
>
> > > On Jan 13, 1:53 pm, RagingPacifist <mohicanl...@gmail.com> wrote:
>
> > > > Here's an example of what I'm seeing:http://www.thegreatrecovery.com/live
>
> > > > if you look on line 331 of scode.js included in that page:
> > > > this.p.addEventListener("onStateChange","adytt.pl['"+a+"'].st")
>
> > > > It throws a javascript error, the message is different for each
> > > > browser.
> > > > Firefox w/ Firebug throws a "missing exponent" and points to this:
> > > > try { __flash__toXML(adytt%2Epl%5B%27myytplayer%27%5D%2Est(5)) ; }
> > > > catch (e) { "...
>
> > > > It looks like it's html encoding the period in the callback argument.
>
> > > > Chrome just says
> > > > Uncaught SyntaxError: Unexpected token ILLEGAL
>
> > > > Adding version=3 as a parameter to the video url fixes the issue. I'm
> > > > not sure why that's necessary now, when it wasn't 2 days ago. Does it
> > > > default to the AS2 player now if version isn't specified?
>
> > > > On Jan 13, 10:55 am, Jeffrey Posnick <je...@google.com> wrote:
>
> > > > > Hello Folks,
>
> > > > >  If anyone is experiencing an ongoing error with onStateChange not
> > > > > firing, could you please point me to a specific URL I could visit to
> > > > > reproduce the issue?
>
> > > > > Cheers,
> > > > > -Jeff Posnick, YouTube API Team
> > > > > groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
> > > > > @YouTubeDev
>
> > > > > On Jan 12, 5:25 pm, RagingPacifist <mohicanl...@gmail.com> wrote:
>
> > > > > > I'm also having an issue with the onStateChange event that started on
> > > > > > 1/11/2012 at about 6pm CT.
> > > > > > I'm using this plugin (http://www.adlytics.de/omniture/plugins/youtube-
> > > > > > player-tracking.htm) to track youtube activity on my site but it is
> > > > > > throwing a javascript error.
>
> > > > > > This line causes the javascript error:
> > > > > > adytt.p.addEventListener("onStateChange","adytt.st");
>
> > > > > > The issue seems to be the . in the call back, prior to yesterday
> > > > > > passing on object.function as the callback worked fine, now it fails.
>
> > > > > > On Jan 12, 2:05 pm, Peppi <donna...@gmail.com> wrote:
>
> > > > > > > Hi,
>
> > > > > > > Just wondering if something has changed with the Javascript Player API? The
> > > > > > > onStateChange event is no longer firing as of today it looks like.
>
> > > > > > > Thx.

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