#499 ✓ staged
Rick

Popcorn.youtube() should fire: loaded, loadeddata, canplaythrough

Reported by Rick | May 7th, 2011 @ 02:19 PM | in 1.2 (closed)

The vimeo player is supporting a synthetic "loadedmetadata" event which is the correct name, Popcorn.youtube needs to be updated as well as tested for this event, in place of "loadeddata"

Comments and changes to this ticket

  • Rick
  • Rick

    Rick May 8th, 2011 @ 07:35 PM

    • State changed from “new” to “assigned”
    • Assigned user set to “Rick”

    As it turns out, there was a loadedmetadata event being dispatched, but not tested for

  • Rick

    Rick May 8th, 2011 @ 07:36 PM

    • State changed from “assigned” to “peer-review-requested”
    • Assigned user changed from “Rick” to “Scott Downe”
  • Scott Downe

    Scott Downe May 10th, 2011 @ 12:38 PM

    • State changed from “peer-review-requested” to “under-review”
  • Scott Downe
  • Scott Downe

    Scott Downe May 11th, 2011 @ 01:53 PM

    • State changed from “under-review” to “review-needs-work”
    • Milestone order changed from “48” to “0”

    Not a huge issue, and these tests need an overhauling anyway.

    So not a high priority, but yeah, I think tests should be done for both loadedmetadata and loadeddata, in that order.

  • Scott Downe

    Scott Downe May 12th, 2011 @ 09:34 AM

    • Assigned user changed from “Scott Downe” to “Rick”
  • Rick

    Rick May 17th, 2011 @ 11:37 AM

    • Milestone changed from 0.6 to 0.7
    • State changed from “review-needs-work” to “assigned”

    This needs closer attention

  • Rick

    Rick June 18th, 2011 @ 11:39 AM

    • Milestone changed from 0.7 to 0.8
  • Rick

    Rick August 23rd, 2011 @ 12:47 PM

    • Milestone changed from 0.8 to 0.9
  • Rick

    Rick September 12th, 2011 @ 09:16 AM

    • Title changed from “Popcorn.youtube() has incorrectly named "loadeddata" event” to “Popcorn.youtube() should fire: loaded, loadeddata, canplaythrough”
  • Rick

    Rick September 12th, 2011 @ 09:16 AM

    • Assigned user changed from “Rick” to “Scott Downe”
  • Scott Downe

    Scott Downe September 22nd, 2011 @ 03:03 PM

    • Milestone changed from 0.9 to 1.0 Release
    • Milestone order changed from “3” to “0”
  • Scott Downe

    Scott Downe October 28th, 2011 @ 01:27 PM

    • Milestone changed from 1.0 Release to 1.1
    • Milestone order changed from “2” to “0”

    Talked to Chris today about the state of this, and its partner in chrome Vimeo, and we both decided we can push this.

  • Scott Downe

    Scott Downe October 31st, 2011 @ 07:42 PM

    So, doing #795 and #782, I noticed there was no good way to create event listeners for youtube.

    A instance of youtube is required to register events, and creating an instance may fire the event I need a listener for, thus ruining my chance to fire an event.

    This ticket needs to come up with a solution to that problem.

  • Rick

    Rick December 12th, 2011 @ 05:51 PM

    • Milestone changed from 1.1 to 1.2
    • Milestone order changed from “4” to “0”
  • Scott Downe

    Scott Downe March 2nd, 2012 @ 03:38 PM

    • State changed from “assigned” to “peer-review-requested”
    • Assigned user changed from “Scott Downe” to “cadecairos”
    • Milestone order changed from “11” to “0”

    Now that was have a reliable way to setup and test for ready state events, this was too easy.

    https://github.com/ScottDowne/popcorn-js/commits/t499

  • cadecairos

    cadecairos March 2nd, 2012 @ 04:05 PM

    • State changed from “peer-review-requested” to “super-review-requested”
    • Assigned user changed from “cadecairos” to “David Seifried”

    C'est très bon.

    PR+

  • David Seifried

    David Seifried March 2nd, 2012 @ 04:20 PM

    • State changed from “super-review-requested” to “review-needs-work”
    • Assigned user changed from “David Seifried” to “Scott Downe”

    Arn't the event's being fired in the wrong order ( from what I can tell in the unit tests ). Seems like canplaythrough should be the last one that gets fired.

    http://www.w3.org/TR/html5/the-iframe-element.html#dom-media-have_n...

  • Scott Downe

    Scott Downe March 2nd, 2012 @ 07:46 PM

    • State changed from “review-needs-work” to “super-review-requested”
    • Assigned user changed from “Scott Downe” to “David Seifried”

    https://github.com/ScottDowne/popcorn-js/commits/t499

    Fixed the order, and removed the load event. It is not real. Updated tests to listen for this new arrangement.

  • David Seifried

    David Seifried March 4th, 2012 @ 11:51 AM

    • State changed from “super-review-requested” to “review-needs-work”
    • Assigned user changed from “David Seifried” to “Scott Downe”

    I don't think were firing these events properly, it just seems like were doing them all one after another without any regard to what they actually mean. I think with some of the stuff the youtube api offers we could do more to better represent these events. Maybe some of the following could help:

    • loadedmetadata: http://dev.w3.org/html5/spec/Overview.html#event-media-loadedmetadata ** we once we have the video's duration we could probably fire this event seeing as the user is setting the dimensions so I figure once we have the duration that should be good enough.
    • loadeddata: http://dev.w3.org/html5/spec/Overview.html#event-media-loadeddata ** from youtubes docs: onStateChange This event is fired whenever the player's state changes. Possible values are unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5). When the SWF is first loaded it will broadcast an unstarted (-1) event. When the video is cued and ready to play it will broadcast a video cued event (5).

    Maybe we can listen for statechange and fire this once it hits state 5

    • canplaythrough: I imagine this one will be a bit trickier but we can probably mimic the behaviour to some extent by using the byte methods to determine how many bytes have loaded vs how many the video consists. We will have to get some sort of ratio initially of how many bytes are loaded over a given duration to figure this out. https://developers.google.com/youtube/js_api_reference#getVideoStar...

    I'm guessing that this also probably won't get in this release as it looks like quite a bit of work.

  • David Seifried

    David Seifried March 4th, 2012 @ 12:46 PM

    Just talked with scott in irc a bunch about this and he brought to light that youtube fires it's play event only once it has buffered enough, so what I wrote about canplaythrough is wrong. loadeddata and loadedmetadata still need to be handled in some way tho IMO

  • Scott Downe

    Scott Downe March 5th, 2012 @ 09:44 AM

    • State changed from “review-needs-work” to “super-review-requested”
    • Assigned user changed from “Scott Downe” to “David Seifried”

    The issues Dave is talking about regarding metadataloaded and dataloaded is that they are fired way too late, in fact, they are fired just before canplaythrough is fired. This is an issue, but it is not one that I have yet found a solution to.

    This has always been the problem, and was not something introduced with this patch, nor something this patch ever claimed it was going to fix, because of the following reason:

    Youtube API claims it fired a 3 for buffering and a 5 fore video cued, in the current event system, I have never seen these states, so no idea how we can listen to them.

    I included a screen shot of me running a fresh youtube, logging the state as it is triggered. 3 and 5 never happen, expecting them would cause those events to never be fired.

    I say file another ticket in 1.3 to deal with a deeper problem, and land this improvement in 1.2.

    The other option is to block this and put it into 1.3 as well, and continue firing incorrect load events, in the wrong order, on top of not firing a loadedmetadata at all.

    Basically take the good fix instead of holding out for the perfect, that may never come.

  • Scott Downe

    Scott Downe March 5th, 2012 @ 09:46 AM

    • no changes were found...
  • David Seifried

    David Seifried March 5th, 2012 @ 10:36 AM

    • State changed from “super-review-requested” to “review-looks-good”
    • Assigned user changed from “David Seifried” to “Scott Downe”

    Yea I agree Scott, if this isn't an easy or obvious fix then we can push to 1.3 and fix it correctly there. Having these events at least being fired in the correct order is better than not at all.

    So tests are good and passes lint. SR+

  • David Seifried

    David Seifried March 5th, 2012 @ 10:37 AM

    • Assigned user changed from “Scott Downe” to “cadecairos”
  • cadecairos

    cadecairos March 5th, 2012 @ 11:03 AM

    • State changed from “review-looks-good” to “review-needs-work”
    • Assigned user changed from “cadecairos” to “Scott Downe”

    Getting merge conflicts:

    Auto-merging modules/player/popcorn.player.js
    CONFLICT (content): Merge conflict in modules/player/popcorn.player.js
    Auto-merging players/vimeo/popcorn.vimeo.js
    Auto-merging players/youtube/popcorn.youtube.js
    Auto-merging players/youtube/popcorn.youtube.unit.js
    CONFLICT (content): Merge conflict in players/youtube/popcorn.youtube.unit.js
    Automatic merge failed; fix conflicts and then commit the result.

    Scott can you address these issue? Thanks :D

  • Jon Buckley

    Jon Buckley March 5th, 2012 @ 04:48 PM

    • State changed from “review-needs-work” to “review-looks-good”
    • Assigned user changed from “Scott Downe” to “Jon Buckley”

    I'll fix that up

  • Jon Buckley

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Popcorn.js is an HTML5 video framework that lets you bring elements of the web into your videos.

Popcorn.js is a project of Web Made Movies, Mozilla's Open Video Lab.

Shared Ticket Bins

Attachments

Referenced by

Pages