would be swell to allow the passing of attributes instead of filtering them all out

namely,

&autoplay=1

would be nice.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jenlampton’s picture

Yep, this sounds reasonable, can you make me a patch file?

guschilds’s picture

@Andrew_Mallis

Attached is a patch that creates an Autoplay option on the field formatter (Structure > Content Types > Manage Display > click the gear). When checked, all YouTube videos provided in that field will autoplay. This could obviously get messy if you were using Views, etc., but when is auto-playing videos not at least a little bit messy. :)

I believe the original patch was asking for the ability to pass "&autoplay=1" through the field input to allow a single video to autoplay. I'm thinking this may be better accomplished by an Autoplay checkbox on the field widget, with the option to not allow that checkbox (probably off by default, really). That way you aren't requiring users to understand much. What do you think?

I implemented the attached patch first simply because it was easier and may be helpful for some. Because I don't think it satisfies the original request, I won't change the status to "needs review". Feel free to do so, however, if you think this is enough.

jenlampton’s picture

Status: Active » Needs work

I think the field display settings are also available to views - so this may be a suitable solution for that case too. I agree there might also be a need for a per-video solution, but I don't like that as much since it doesn't account for view modes.

Let's go with this for now.

Can you re-roll the patch against the lates 7.x-1.x branch? It won't apply cleanly for me anymore :/

guschilds’s picture

Status: Needs work » Needs review
FileSize
2.89 KB

I agree. You were correct, this setting is also available to Views. Re-rolling the patch exposed a few minor mistakes I made the first time through. This one should be good and apply cleanly to the 7.x-1.x branch.

jenlampton’s picture

This patch looks great :) Thanks!

I changed the default value to FALSE (box not checked) rather than NULL in a few places, and I changed the label of the checkbox from just 'Autoplay' to 'Play video automatically when loaded (Autoplay).'

For some reason this patch breaks the form #states for custom video sizes on the article content type, but not on the page. I think it may just be my set up, so I'll start over with a clean db and do some more testing, but wanted to throw this patch back up and see if anyone else gets the same behavior.

jenlampton’s picture

Just a note, I found the form states bug, and it has nothing to do with this patch. I'll fix that separately :)

guschilds’s picture

Status: Needs review » Reviewed & tested by the community

I agree with all of the changes you made in #5 and the patch works as desired when applied.

guschilds’s picture

Status: Reviewed & tested by the community » Fixed

committed to the 7.x-1.x branch.

misthero’s picture

FileSize
78.47 KB
5.05 KB

sorry wrong topic, I moved my post here: http://drupal.org/node/1571420#comment-6415246

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.