google / ioweb2015

I/O Web App 2015
https://events.google.com/io2015/
Apache License 2.0
687 stars 122 forks source link

Use playbackstarted to fade in/out the YT thumbnail #428

Open jeffposnick opened 9 years ago

jeffposnick commented 9 years ago

There's a new <google-youtube playbackstarted> attribute, and it would be nice to use it like:

  <img src="images/home/recap-500@2x.jpg" fit
       class="{{ {fullvideo_thumbnail: true, fadeout: playbackStarted} | tokenList}}">
  <google-youtube videoid="ksvdvCDO7pA" chromeless height="100%" width="100%" fit
                  autoplay="1" playbackstarted="{{playbackStarted}}">
  </google-youtube>

to trigger the thumbnail fade in/out. However, I'm seeing sporadic cases where the YouTube Player API event handler isn't firing, causing playbackstarted not to be set to true. Since this would mean that the video playback starts but is completely obscured by the thumbnail, it's not worth the risk of implementing this new logic.

Once the underlying issue with the Player API can be diagnosed and fixed, I'll revisit.

ebidel commented 9 years ago

Should I switch over to using this or should we wait?

jeffposnick commented 9 years ago

Hold off. I haven't started looking into the Player API issue, so there's still a risk of the thumbnail not disappearing when things bug out.

ebidel commented 9 years ago

Ping.

jeffposnick commented 9 years ago

Right. https://github.com/GoogleWebComponents/google-youtube/pull/34 might have helped—the error I was seeing was triggered after loading/closing the <google-youtube> element a few times, and the cleanup being done in that PR could address some of it. (Or it may just be a Player API bug.)

I'll report back.

jeffposnick commented 9 years ago

Unfortunately, it's still reproducible.

I've narrowed things down to the initial play state change event not firing, though everything else seems to be working when it happens—the Player API loads, and the paused + ended state change event do fire once the video is over.

I'll raise an internal bug with the YouTube Player API team based on what I'm seeing.

jeffposnick commented 9 years ago

An update on this: I've been trying and failing to reproduce the issue in a standalone demo, which makes it infeasible to file a bug about it.

http://jsbin.com/wekicu/5/edit?html,output should trigger the issue, based on what I'm seeing in the context of the I/O app, but it doesn't.