Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The thumbnail generation for private videos on Vimeo does not load the images because the thumbnail is loaded via Simple API instead of the Advanced API that loads the images via oEmbed.
As quoted from vimeo for the same issue in Media:Vimeo in http://drupal.org/node/1587686:
The Simple API is for public data only. If your videos are private, you will need to use the Advanced API. If your video is set to hide from vimeo.com, but is embeddable, you may also be able to use oEmbed.
Attached is a patch that use the Advanced API for image loading.
Comments
Comment #1
spuky CreditAttribution: spuky commentedCode makes sense and running into the problem it works so I set it to rtbc
Comment #2
mrweiner CreditAttribution: mrweiner commentedThis does result in the thumbnails being correctly generated. However, its throwing this error in various places involving the field.
Strict warning: Only variables should be passed by reference in template_preprocess_video_embed_field_embed_code() (line 355 of /.../sites/all/modules/video_embed_field/video_embed_field.module).
Comment #3
dpliscoff CreditAttribution: dpliscoff commentedHi mrwiner,
I' not able to reproduce the error. Can you give me some hints to check it?
Comment #4
mrweiner CreditAttribution: mrweiner commentedI can try to, but there doesn't seem to be a really solid way for me to reproduce it.
When I just went to the site, it popped up on the home page. I'm assuming because right now it's the default front page with a feed of content, and the content displayed in that feed contains video embed fields.
It also pops up for me when I visit the edit form for a node with a populated video embed field, as well as in the form for a view that utilizes the thumbnails. For the most parts it seems like the error is thrown once, and then doesn't display unless content is re-saved. So if I save a node that has a thumbnail and go to edit it, the error doesn't show until after I save it again, at which point the error shows again on the edit page. Re-saving did not cause the homepage error to show again, so I don't know how often it refreshes on there. Not sure when it decides to pop up on the view edit page.
Nothing seems to be affected by the error besides the fact that it's there, though.
Comment #5
dpliscoff CreditAttribution: dpliscoff commentedI don't know if this is directly related with the patch, but following this http://drupal.stackexchange.com/questions/6322/strict-warning-only-variables-should-be-passed-by-reference-in-include maybe changing how the call to drupal_render can help. In vimeo_embed_field.module line 355, replace
with
Again, I'm not able to make the warning appear in the views or administration pages, so I'm guessing a bit here.
Comment #6
mrweiner CreditAttribution: mrweiner commentedYup, changing that line that seems to have done the trick. Not sure how to create patches though, so that's on you. :)
EDIT: Woops, accidentally changed the status. I guess it's pre-emptive, but if a patch with the change is submitted then the status will be accurate.
Comment #7
dpliscoff CreditAttribution: dpliscoff commentedToo late, this issue is already fixed on 7.x-2.x-dev :). Check https://drupal.org/node/1913720
Comment #8
vinmassaro CreditAttribution: vinmassaro commented@dpliscoff: Tested your patch and it works great. I've updated the patch since it wasn't applying cleanly for me, and gave you attribution. Setting back to needs review for a final check on this patch. This is against 7.x-2.x HEAD. Thanks!
Comment #9
vinmassaro CreditAttribution: vinmassaro commentedUpdated patch that removes some whitespace.
Comment #10
dpliscoff CreditAttribution: dpliscoff commented@vinmassaro Thanks. Tested your patch on 7.x-2.x-dev and works ok. Back to RTBC.
Comment #11
gfed CreditAttribution: gfed commentedPrivate videos can sometimes have urls where there are multiple other codes and variables. This addresses this issue. Seems to be working fine on my end.
Comment #12
Khalor CreditAttribution: Khalor commentedThe current stock 7.x-2.x-dev branch doesn't fix the issue.
The patch in #9 applies cleanly agains the current 7.x-2.x-dev version and fixes the issue.
Let's get this committed?
(The patch in #11 didn't apply cleanly)
Comment #13
JenniferRader CreditAttribution: JenniferRader commentedThanks for this thread...it was super helpful for me. Patch #9 won't apply to beta7, but of course can be applied manually, which worked great.
Is it likely this will get committed on a future release?
Comment #14
illeace CreditAttribution: illeace commentedI have only done a small amount of testing, but so far patch #11 works for me. I had to apply it manually, though. Here's a re-roll of that patch that will apply to the latest 7.x-2.x-dev release.
Comment #15
stilblütler CreditAttribution: stilblütler commentedi applied patch #14 to file "video_embed_field.handlers.inc" of video_embed_field-7.x-2.x-dev (Date: 2014-Jul-27).
that didn’t work, because in "function _video_embed_field_get_vimeo_id($url)" there were missing the following two lines
before the closing of the the function with:
---
after correction the function, starting at line 431 in the file "video_embed_field.handlers.inc", reads as follows:
the thumbnails of links to private vimeo videos appear after re-saving the affected nodes.
Comment #16
illeace CreditAttribution: illeace commentedstilblütler is quite right. Thanks for catching that mistake! Here's another revised patch file.
Comment #17
plopescHello
Nice catch I tested patch #13 and works fine for public and not presento on vimeo videos, but not for private ones because
$video['thumbnail_url']
is not always set. So it should be something like this:Path in #16 is missing this part of the patch, so it is incomplete. Moreover, the approach of
strlen($digits) >= 8
is not appropriate at all given that there are vimeo videos where the id lenght is minor than 8 digits. IE https://vimeo.com/85. I think that there is a URL pattern for those videos that we could use to extract the URL from there.Thank you.
Comment #18
pm5 CreditAttribution: pm5 commentedI have merge the changes in #17 with #14 and #16 to produce a patch against the latest 7.x-2.x-dev release. I can confirm that it works for the public (but not visible on vimeo and embeddable only by our domain) videos on our site.
Comment #19
pm5 CreditAttribution: pm5 commented(Posted again caused by HTTP 504.)
I have merge the changes in #17 with #14 and #16 to produce a patch against the latest 7.x-2.x-dev release. I can confirm that it works for the public (but not visible on vimeo and embeddable only by our domain) videos on our site.
Comment #20
pm5 CreditAttribution: pm5 commentedOops. The patch I just sent was from our web site repo. Re-send the same patch for the module.
Comment #21
pm5 CreditAttribution: pm5 commentedComment #22
plopescHello pm5
Thank you for your patch. However, as i said in #17,
strlen($digits) >= 8
is not a valid way to decide which URL parameter should be taken.Are you sure that Vimeo's documentation does not provide a way to determine the video id from an URL in that format?
Thank you
Comment #23
tte CreditAttribution: tte commentedHere's a small patch I wrote which should take care of properly identifying a vimeo video's ID by querying the oembed response array. I did some minor cleanups as well.
Comment #24
tte CreditAttribution: tte commentedOh, just found out that my previous patch applies against video_embed_field-empty_private_vimeo_thumbnails-1996924-19.patch. Here's another patch which applies against vanilla 7.x-2.0-beta8.
Comment #25
zrpnrThe patch in #24 worked for me, the private video thumbnails load correctly now.
I just re-rolled the patch against 7.x-2.x dev, removed the path to the file.
Didn't make any other changes to speely's code, thanks! Marking RTBC.
Comment #26
bocaj CreditAttribution: bocaj commentedI was having this same issue. I applied the patch in #25 and resaved all of the nodes with VBO and it worked perfectly. Would love to see this get commited soon!
Thanks everyone for your work on this!
Comment #28
plopescCommitted. Thank you!
Comment #30
Leon Kessler CreditAttribution: Leon Kessler commentedThis commit removes the
data_function
from the vimeo handler definition, this is an API change (other modules may be using thedata_function
and thevideo_data
object on the field).Adding related issue to bring this back in.
Comment #31
mpp CreditAttribution: mpp commentedFYI, this is no longer working.
source: https://developer.vimeo.com/apis/oembed
This would require the new API (developer.vimeo.com/api). See documentation on https://developer.vimeo.com/api/start
So the new API with keys and a token is needed to get a video thumbnail for private video's (https://api.vimeo.com/videos/{video_id}).
Comment #32
joelstein CreditAttribution: joelstein commentedThe patch in #2862500-5: Private Vimeo thumbnails are missing fixes this issue.