Friday, March 2, 2012

[YouTube-API] Re: iframe API player does not call onError if initialized with unembeddable video or bad video ID

Hello Tim,

Hmmm. Does onError fire if you attempt playback on the <iframe> using
the JavaScript API's playVideo() method?

Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev


On Mar 1, 5:02 am, Tim Sebastian <t...@trakken.de> wrote:
> Hi Jeffrey,
>
> sorry to reopen that issue, but i just ran into it.
> If the Video-Iframe already exists and then gets "inserted" to the API
> the onError still doesnt fire.
>
> An example Code could look like this
>
> <iframe  id="youtube_vid" src="some youtube video with wrong
> parameters"></iframe>
> <script>
> var player = document.getElementById("youtube_vid");
> new YT.Player(player, {
> events: {
> 'onStateChange': function(){console.log(arguments)},
> 'onError': function(){console.log(arguments)}}
> });
>
> </script>
>
> Is this "working as intended" because the Player is not build with the API
> itself?
> I am trying to track Errors for existing Pages, the only other way would be
> to take any found iframe, delete it and replace it with a API-build version
> of it.
>
> Cheers,
> Tim
>
>
>
>
>
>
>
> On Friday, July 1, 2011 4:57:13 PM UTC+2, Jeffrey Posnick wrote:
>
> > Hey All,
>
> >  So unfortunately there's no way for us to know that a video isn't
> > playable while it's still cued. Requesting the necessary information
> > to determine whether a video is playable is an expensive call, and we
> > defer doing it until we know that the user actually wants to see the
> > video played.
>
> >  I just want to make sure I'm not missing any nuances in what you're
> > reporting, though. You do actually see the onError event fire when
> > playback is attempted for the unembeddable video, correct? It's just
> > that when the video is still cued, there's no onError fired?
>
> > Cheers,
> > -Jeff Posnick, YouTube API Team
> > ~ YouTube is hiring! ~http://google.com/jobs/workyoutube~
>
> > On Jun 24, 12:02 pm, Jeffrey Posnick <je...@google.com> wrote:
> > > Hello Tom/John,
>
> > >  I'll bring this up with the Players engineering team, as we certainly
> > > should start indicating the error in some way. It's silly to have to
> > > put hacks in place to code around this.
>
> > > Cheers,
> > > -Jeff Posnick, YouTube API Team
> > > ~ YouTube is hiring! ~http://google.com/jobs/workyoutube~
>
> > > On Jun 20, 12:56 pm, TC <tcoll...@gmail.com> wrote:
>
> > > > The workaround I use in my production code is different than loading a
> > > > known good video first.  I set a 5 second timeout after loading the
> > > > player and if the video hasn't started playing yet, then call
> > > > getDuration() and if it returns undefined I assume the video is
> > > > unembeddable or invalid.  Not sure my workaround is better than the
> > > > one you suggested.
>
> > > >   -Tom
>
> > > > On Jun 20, 12:32 am, John Hurliman <jhurli...@cull.tv> wrote:
>
> > > > > I've been trying to deal with this issue as well. That's an
> > interesting
> > > > > workaround that you found by loading a known good video first, and
> > may have
> > > > > to do until the YouTube team can address the problem.
>
> > > > > John
>
> > > > > On Fri, Jun 17, 2011 at 6:17 PM, TC <tcoll...@gmail.com> wrote:
> > > > > > When I initialize the iframe API player with an unembeddable video
> > > > > > onError is not called and I have no indication that there is a
> > > > > > problem.
>
> > > > > > Here is an example unembeddable video:
> > > > > >http://www.youtube.com/watch?v=Vm31xBjfMNY
> > > > > > A link to a demo of this issue:
> > > > > >http://tcollier-sandbox.heroku.com/youtube-unembeddable2.html
> > > > > > My sample code:
>
> > > > > >          player = new YT.Player('player', {
> > > > > >            height: '390',
> > > > > >            width: '640',
> > > > > >            videoId: 'Vm31xBjfMNY',
> > > > > >            events: {
> > > > > >              onError: function(event) { alert('Error code:
> > > > > > '+event.data); }
> > > > > >            }
> > > > > >          });
>
> > > > > > I've created a similar demo where the player is initialized with
> > an
> > > > > > embeddable video, then an unembeddable video is loaded into the
> > player
> > > > > > using the API here:
> > > > > >http://tcollier-sandbox.heroku.com/youtube-unembeddable.html;
> > > > > > in this case, onError is called.
>
> > > > > > The behavior is the same for an invalid video ID (which may point
> > to a
> > > > > > video that has been taken down by the content owner).
>
> > > > > > --
> > > > > > 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.
> On Friday, July 1, 2011 4:57:13 PM UTC+2, Jeffrey Posnick wrote:
>
> > Hey All,
>
> >  So unfortunately there's no way for us to know that a video isn't
> > playable while it's still cued. Requesting the necessary information
> > to determine whether a video is playable is an expensive call, and we
> > defer doing it until we know that the user actually wants to see the
> > video played.
>
> >  I just want to make sure I'm not missing any nuances in what you're
> > reporting, though. You do actually see the onError event fire when
> > playback is attempted for the unembeddable video, correct? It's just
> > that when the video is still cued, there's no onError fired?
>
> > Cheers,
> > -Jeff Posnick, YouTube API Team
> > ~ YouTube is hiring! ~http://google.com/jobs/workyoutube~
>
> > On Jun 24, 12:02 pm, Jeffrey Posnick <je...@google.com> wrote:
> > > Hello Tom/John,
>
> > >  I'll bring this up with the Players engineering team, as we certainly
> > > should start indicating the error in some way. It's silly to have to
> > > put hacks in place to code around this.
>
> > > Cheers,
> > > -Jeff Posnick, YouTube API Team
> > > ~ YouTube is hiring! ~http://google.com/jobs/workyoutube~
>
> > > On Jun 20, 12:56 pm, TC <tcoll...@gmail.com> wrote:
>
> > > > The workaround I use in my production code is different than loading a
> > > > known good video first.  I set a 5 second timeout after loading the
> > > > player and if the video hasn't started playing yet, then call
> > > > getDuration() and if it returns undefined I assume the video is
> > > > unembeddable or invalid.  Not sure my workaround is better than the
> > > > one you suggested.
>
> > > >   -Tom
>
> > > > On Jun 20, 12:32 am, John Hurliman <jhurli...@cull.tv> wrote:
>
> > > > > I've been trying to deal with this issue as well. That's an
> > interesting
> > > > > workaround that you found by loading a known good video first, and
> > may have
> > > > > to do until the YouTube team can address the problem.
>
> > > > > John
>
> > > > > On Fri, Jun 17, 2011 at 6:17 PM, TC <tcoll...@gmail.com> wrote:
> > > > > > When I initialize the iframe API player with an unembeddable video
> > > > > > onError is not called and I have no indication that there is a
> > > > > > problem.
>
> > > > > > Here is an example unembeddable video:
> > > > > >http://www.youtube.com/watch?v=Vm31xBjfMNY
> > > > > > A link to a demo of this issue:
> > > > > >http://tcollier-sandbox.heroku.com/youtube-unembeddable2.html
> > > > > > My sample code:
>
> > > > > >          player = new YT.Player('player', {
> > > > > >            height: '390',
> > > > > >            width: '640',
> > > > > >            videoId: 'Vm31xBjfMNY',
> > > > > >            events: {
> > > > > >              onError: function(event) { alert('Error code:
> > > > > > '+event.data); }
> > > > > >            }
> > > > > >          });
>
> > > > > > I've created a similar demo where the player is initialized with
> > an
> > > > > > embeddable video, then an unembeddable video is loaded into the
> > player
> > > > > > using the API here:
> > > > > >http://tcollier-sandbox.heroku.com/youtube-unembeddable.html;
> > > > > > in this case, onError is called.
>
> > > > > > The behavior is the same for an invalid video ID (which may point
> > to a
> > > > > > video that has been taken down by the content owner).
>
> > > > > > --
> > > > > > 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.
> On Friday, July 1, 2011 4:57:13 PM UTC+2, Jeffrey Posnick wrote:
>
> > Hey All,
>
> >  So unfortunately there's no way for us to know that a video isn't
> > playable while it's still cued. Requesting the necessary information
> > to determine whether a video is playable is an expensive call, and we
> > defer doing it until we know that the user actually wants to see the
> > video played.
>
> >  I just want to make sure I'm not missing any nuances in what you're
> > reporting, though. You do actually see the onError event fire when
> > playback is attempted for the unembeddable video, correct? It's just
> > that when the video is still cued, there's no onError fired?
>
> > Cheers,
> > -Jeff Posnick, YouTube API Team
> > ~ YouTube is hiring! ~http://google.com/jobs/workyoutube~
>
> > On Jun 24, 12:02 pm, Jeffrey Posnick <je...@google.com> wrote:
> > > Hello Tom/John,
>
> > >  I'll bring this up with the Players engineering team, as we certainly
> > > should start indicating the error in some way. It's silly to have to
> > > put hacks in place to code around this.
>
> > > Cheers,
> > > -Jeff Posnick, YouTube API Team
> > > ~ YouTube is hiring! ~http://google.com/jobs/workyoutube~
>
> > > On Jun 20, 12:56 pm, TC <tcoll...@gmail.com> wrote:
>
> > > > The workaround I use in my production code is different than loading a
> > > > known good video first.  I set a 5 second timeout after loading the
> > > > player and if the video hasn't started playing yet, then call
> > > > getDuration() and if it returns undefined I assume the video
>
> ...
>
> read more »

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