#834 ✓ staged
Karim Hamidou

Youtube player automatically starts playing the video

Reported by Karim Hamidou | November 9th, 2011 @ 08:57 AM | in 1.2 (closed)

See the following fiddle for a test case : http://jsfiddle.net/UbYXt/ .

Comments and changes to this ticket

  • Scott Downe

    Scott Downe November 10th, 2011 @ 01:39 PM

    Should be able to turn on and off autoplay using query string, and not an options object, like this:

    Popcorn.youtube( 'video1', 'http://www.youtube.com/watchv=9oar9glUCL0?autoplay=1' );
    

    That being said, it's not working, so this is a bug.

  • Scott Downe

    Scott Downe November 10th, 2011 @ 01:39 PM

    • Milestone set to 1.1
    • Milestone order changed from “76” to “0”
  • David Seifried

    David Seifried November 14th, 2011 @ 02:06 PM

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

    David Seifried November 16th, 2011 @ 04:01 PM

    I think defaulting the player to be paused is legitimate, but there also seems to be an issue when trying to trigger a play/pause after creating a popcorn instance with youtube, see the following:

    var pop = Popcorn.youtube( "#video1", "http://www.youtube.com/watchv=9oar9glUCL0" );
    pop.pause(); // or pop.play();
    

    the play/pause call will not get executed and youtube will just continue what it was doing ( in this case autoplaying ). I had a talk with Rick on irc and we think its due to youtube not loading the video in time and popcorn is simply running over the play/pause call. This may need to be handled in another ticket tho.

  • Karim Hamidou

    Karim Hamidou November 17th, 2011 @ 04:31 AM

    the play/pause call will not get executed and youtube will just continue what it was doing ( in this case autoplaying). I had a talk with Rick on irc and we think its due to youtube not loading the video in time and popcorn is simply running over the play/pause call. This may need to be handled in another ticket tho.

    yes, I get the same behaviour from popcorn with my jwplayer plugin (btw, it makes its unit tests fail), so it's probably a bug in the baseplayer code.

  • David Seifried

    David Seifried November 17th, 2011 @ 09:36 AM

    Thanks Karim, I'm going to work on fixing this today and see what I come up with

  • gkindel
  • David Seifried

    David Seifried December 9th, 2011 @ 11:02 AM

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

    Scott Downe December 21st, 2011 @ 11:42 AM

    I am trying the above fix for just pause, but still having issues with &autoplay=1/0.

    Going to build on it to get that also working.

  • Scott Downe

    Scott Downe December 21st, 2011 @ 04:52 PM

    • State changed from “assigned” to “peer-review-requested”
  • David Seifried

    David Seifried January 3rd, 2012 @ 01:20 PM

    • State changed from “peer-review-requested” to “blocked”

    Unit tests seem to hang on 8. Running Player Errors, but that seems to be an already existing issue which im going to file a bug on. Other than that this looks fine with running isolated single tests on the autoplay feature. I don't want to push this into SR yet until we figure out the issue with unit tests stalling. Setting to blocked by #882.

  • Scott Downe

    Scott Downe January 3rd, 2012 @ 06:13 PM

    That final, hanging unit test was always there, and I believe it always hung.

    It is exposed when a browser is too fast, because the player can error out before the event gets registered, thus the test never happens.

  • David Seifried

    David Seifried January 4th, 2012 @ 10:18 AM

    We should make our tests handle it accordingly then

  • Scott Downe

    Scott Downe February 17th, 2012 @ 04:20 PM

    • State changed from “blocked” to “peer-review-requested”
    • Assigned user changed from “David Seifried” to “mjschranz”

    #882 should allow the test to not timeout, but simply fail. Should resolve the blocked status.

    It fails because of #863. That is another issue not caused or solved by this patch.

    We need this to land, there has been multiple requests for it.

    Going to get Mat to pr it, then he'll assign it back to Dseif for sr.

  • mjschranz

    mjschranz February 21st, 2012 @ 11:32 AM

    • State changed from “peer-review-requested” to “review-needs-work”
    • Assigned user changed from “mjschranz” to “Scott Downe”

    I'm not 100% sure if this is fixed or not. When I try your tests, and am able to get the first block to finish, it says that the autoplay stuff worked. However when I copy the updated youtube and popcorn files into my popcorn-maker repo to try on the project I'm working on I'm having my videos still autoplay.

  • Scott Downe

    Scott Downe February 21st, 2012 @ 12:24 PM

    Do you have a reduced test case? Or something not so reduced if needs be?

    Can I see the line you use to initiate youtube?

  • mjschranz

    mjschranz February 21st, 2012 @ 12:51 PM

    https://github.com/mjschranz/popcorn-js/tree/temp

    Run the test.html file in my mediaspawner plugin directory.

    A reproduction of one of the youtube videos being used in my project.

  • Scott Downe

    Scott Downe February 22nd, 2012 @ 01:10 AM

    Ok, after way too much fighting with Youtube... again, I got this: https://github.com/ScottDowne/popcorn-js/commits/t834

    Only problem is it is randomly failing a test I do not believe I touched. I will look into it tomorrow when I get a chance, but I need rest...

  • mjschranz

    mjschranz February 22nd, 2012 @ 10:14 AM

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

    I get fails on the Player Errors and the Plugin Factory tests due to timing out. Otherwise, looks good to me. It also doesn't autoplay in that previous reduced test case.

    Assuming you ment to pass this on to me, I am going to PR+ it.

  • Scott Downe

    Scott Downe February 22nd, 2012 @ 08:06 PM

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

    OK, I am now passing all tests cept the known failure.

    https://github.com/ScottDowne/popcorn-js/tree/t834c

    Note, that is t834c with a "c" on the end.

    mj, I am going to have to ask you to review this again. The last one had a test failing, now it should be ready to rock!

  • Scott Downe

    Scott Downe February 22nd, 2012 @ 08:13 PM

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

    Scratch that, still broken. Grog.

    I really hate Youtube's API. Too much state to keep track of.

    They have a playing(1), paused(2), and neither state(-1).

    If I call seekTo in any state but paused, including the -1 state, it will start playing. This is their INTENDED functionality. Not a bug. It is right in the documentation.

    "Seeks to a specified time in the video. If the player is paused when the function is called, it will remain paused. If the function is called from another state (playing, video cued, etc.), the player will play the video."

    That's not TOO bad, if it wasn't for the fact that calling pause does nothing until after play has been called once. Add to that, the fact that popcorn should cache play, pause, and currentTime calls before youtube is ready, and apply them once youtube is ready, you have like 9 states to keep track of. I have tests for each state, but I keep breaking them... Just frustrating, but I will get it.

  • Scott Downe

    Scott Downe February 22nd, 2012 @ 08:40 PM

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

    Scratch scratch that, found a fix.

    https://github.com/ScottDowne/popcorn-js/tree/t834c

    Again, there is a c at the end of my branch.

  • mjschranz

    mjschranz February 23rd, 2012 @ 11:35 AM

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

    Other than the known issue of tests failing on first load, and the one Timeout error on Player Errors afterwards, this looks good to me.

    PR+

  • cadecairos

    cadecairos February 23rd, 2012 @ 03:55 PM

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

    Aside from Youtube's nonsense, the tests will eventually pass, except for the known failures with the last test. Autoplay issues have been solved..

    Scott: can you update this so that it will work with the new player module?

    review looks good after you do that.

  • Scott Downe

    Scott Downe February 24th, 2012 @ 05:38 PM

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

    Actually, this merge went without conflict. Should be good to go as is.

  • Scott Downe

    Scott Downe February 29th, 2012 @ 12:19 PM

    I built this on top of #921, which is review-looks-good waiting to be staged, just an fyi.

  • cadecairos

    cadecairos February 29th, 2012 @ 12:44 PM

    • State changed from “super-review-requested” to “review-looks-good”

    SR+

  • cadecairos

    cadecairos February 29th, 2012 @ 12:53 PM

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

    Merge conflicts with develop!

    Auto-merging players/youtube/popcorn.youtube.html
    CONFLICT (content): Merge conflict in players/youtube/popcorn.youtube.html
    Auto-merging players/youtube/popcorn.youtube.unit.html
    Auto-merging players/youtube/popcorn.youtube.unit.js
    CONFLICT (content): Merge conflict in players/youtube/popcorn.youtu

    Please fix

  • cadecairos

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

Referenced by

Pages