Support from Acquia helps fund testing for Drupal Acquia logo

Comments

droath’s picture

Status: Active » Needs review
FileSize
5.74 KB

This patch implements a way for opening YouTube videos in a colorbox modal. You need to make sure you have colorbox enabled, and have "Enable Colorbox load" checked in the colorbox configurations.

Then when choosing a formatter for the YouTube field, select "YouTube thumbnail" and then select "Colorbox" under the "link image to" field. The YouTube video should now display in a colorbox modal when you click the YouTube video thumbnail on a given node.

spanac’s picture

@droath

Great idea :) Thank you for the patch

guschilds’s picture

Nice work and thanks for the patch! It worked well for me during a few quick tests and the code looks solid. I don't have much experience with Colorbox so it would be nice for a few folks that use it more often to test it more thoroughly before marking as RTBC. Thanks again!

trebol’s picture

droath, I apply your patch all the configuration works ok, but in the page where i add youtube field thumbnails with colorbox, the videos are not loading and i get an error message in this line:

'query' => $display['settings']['colorbox']['parameters'],

Piece of code of this part:

+        // Add support for the colorbox module.
+        if (isset($link_colorbox) && $link_colorbox) {
+          $uri = array(
+            'path' => 'http://youtube.com/embed/' . $item['video_id'],
+            'options' => array(
+              'attributes' => array(
+                'class' => 'colorbox-load',
+              ),
+              'html' => TRUE,
+              'external' => TRUE,
+              'query' => $display['settings']['colorbox']['parameters'],
+            ),
+          );
+        }
+

Any help to fix it?

Edit: The error is: Notice: Undefined index: colorbox in youtube_field_formatter_view()

Edit 2: I edited the article and delete cache and now works perfectly

kyletaylored’s picture

Patch #1 works great! Great job.

infines’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
ytsejam’s picture

Wonderful patch, thanks for it! Added a simple option for autoplay (this is my first patch, please be gentle).

Vensdale’s picture

Patch #1 works fine. Patch #7 (yeah! autoplay option will be great!) gives an error in patch string 26. I hope colorbox support will be in next youtube field release.

guschilds’s picture

Version: 7.x-1.0 » 7.x-1.1
Status: Reviewed & tested by the community » Needs work

Vensdale is correct. The patch in #7 does not cleanly apply to the 7.x-1.1 release.

Could someone re-roll it? Thanks.

kaztur’s picture

FileSize
4.62 KB

Patch #1 works fine on my pages with video, great thank You for it. But some notices on /admin/structure/types/manage/my_type/display page:

Notice: Undefined index: youtube_autoplay in youtube_field_formatter_settings_summary() (383 in /sites/all/modules/youtube/youtube.module) ...
Notice: Undefined index: youtube_showinfo ...
Notice: Undefined index: youtube_controls ...
Notice: Undefined index: youtube_autohide ...
Notice: Undefined index: youtube_iv_load_policy ...

Below is my youtube.module file (which was checked). Can You help me!

guschilds’s picture

kaztur,

You're experiencing the bug fixed by the patch in #2 of #2187393: Switching from video to thumbnail as format breaks.

The committed fix has not yet made it into a release, but applying that patch should fix those notices.

Gus

kaztur’s picture

Great Thanks, Gus! Those patch works goods for my error.

P.S. I'm sorry, while I loaded my attachment I hide first two ones - I thought they will hide from only my post, but they was hidden from the first post, and I don't know how to return them being visible.

kaztur’s picture

P.S. I'm sorry, while I loaded my attachment I hide first two ones - I thought they will hide from only my post, but they was hidden from the first post, and I don't know how to return them being visible.

Now it seems to be good in the first post.

And in the hidden file there's edited for the patch from #1 youtube.module file from 1.1 version.

ytsejam’s picture

I had to re-apply the autoplay patch from #7 against the new 1.2 version, and noticed my previous version wasn't prepared good enough, so I applied all the changes by hand and generated a new patch with diff.

I hope it would be OK now, at least works fine for me (drupal 7.26, colorbox 2.5, youtube 1.2).

guschilds’s picture

Version: 7.x-1.1 » 7.x-1.2
Status: Needs work » Needs review
guschilds’s picture

I appreciate everyone's work on this.

I was initially hesitant to add this to this module because it strives to maintain simplicity, but then I saw the number of active Colorbox installations. To remain simple while adding this support, I think creating a separate YouTube Field Colorbox module makes sense. The module would still live within the YouTube Field project.

I took the patch from #14 (had to manually apply it) and separated everything out into another module. I made small adjustments and improvements as I went. For example, warning users that 'Enable Colorbox load' must be enabled in the Colorbox module settings. Also, removing the option to not use an iframe for the content because it would never work when chosen.

The patch applies to 1.2. Please give it a try (don't forget to enable YouTube Field Colorbox).

I believe this is at a state where it can be committed after a bit of review.

Thanks again!

Vensdale’s picture

FileSize
32.61 KB

Can someone say how can I remove colorbox title overlay on youtube videos? That overlay doesn't allow to control youtube player.

guschilds’s picture

Vensdale,

When I use the patch from #16 and the Colorbox module, I am not able to reproduce what you are seeing. I have tried multiple Colorbox styles and I never get a title bar that covers the YouTube controls on any of them.

I'm guessing the easiest route would be to use CSS rules that override theirs in order to hide that title bar.

Hope that helps.

Gus

jay.lee.bio’s picture

FileSize
173.43 KB
168.85 KB

Guschilds, #16 works perfectly. Thank you so much!

And as for #17, I think what Vensdale might be referring to is the fact that when you start playing any YouTube video using Colorbox, the header & footer will disappear after a few seconds (which to me looks ok). I attached a couple screenshots taken from my website: http://mediography.by/media/tigris-and-euphrates

jay.lee.bio’s picture

Status: Needs review » Reviewed & tested by the community
jay.lee.bio’s picture

FileSize
312.1 KB
193.79 KB

One minor issue I wanted to bring up is that unlike the case of multiple images where Colorbox shows the counter that allows you to click through as a gallery, it does not work for multiple YouTube videos. I guess the default Colorbox behavior for this is that clicking is needed for controlling the various buttons in the video shown.

But I thought maybe somebody knew of a solution for videos where Colorbox would show the counter just like images and clicking it specifically will override the default behavior and show the next video?

guschilds’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Needs review
FileSize
11.54 KB

Jay Lee,

Thanks for testing this.

Your idea to group videos together with the arrows/counter is a good one. I've implemented it in the attached patch, which applies to the latest dev release. After applying it (and clearing cache):

  1. Navigate to the display settings for the field. Click the gear to configure them.
  2. Under Colorbox Settings, click "Group all videos on the page into a gallery" to be true.
  3. Save those settings.

Now all videos on the page should be part of a gallery, as you desire.

Please give that a shot and let me know how it goes. I'd actually like to get this work committed pretty soon.

Thanks!
Gus

guschilds’s picture

jay.lee.bio’s picture

Guschilds, I applied the patch in #22 on my test server and it works flawlessly. It's exactly how I envisioned in my mind. Thank you so much!

jay.lee.bio’s picture

Status: Needs review » Reviewed & tested by the community
jay.lee.bio’s picture

FileSize
190.59 KB

I'm attaching a screenshot, because I noticed that YouTube has also fixed a very minor issue. If you look at the second screenshot from #19, you'll notice that the footer is not completely gone (look at the bits of red & yellow towards the left bottom). That problem is now gone too. :D

  • guschilds committed 8882012 on 7.x-1.x
    Issue #1929652 by droath, trebol, kyletaylored, infines, ytsejam,...
guschilds’s picture

Status: Reviewed & tested by the community » Fixed

This has been committed to the project. It can be found in the latest dev release and will be included in the next stable release.

Thanks so much to everyone who provided code, feedback, and testing! Couldn't have done it without ya!

Bikkne’s picture

Haven't seen this before, but when I tried to update youtube to the DEV release it might be a corrupt dev upload ?

"drush dl youtube --dev
File youtube-7.x-1.x-dev.tar.gz_date=1407896928 is corrupt (wrong md5 checksum). "

guschilds’s picture

Odd, Bikkne. I've never seen that before, but it's happening to me too.

I've googled "drupal File is corrupt (wrong md5[error] checksum)." and am finding a lot of threads with very few answers. It seems to happen unpredictably for random projects and eventually goes away. I'll keep my eye on this and hopefully it resolves itself soon.

Status: Fixed » Closed (fixed)

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