Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Through YouTube API (i don't know that about Vimeo) u can retrieve video duration:
echo 'Duration: ' . $videoEntry->getVideoDuration() . "\n";
Can u also integrate this feature? it can be very useful!
P.D. there are a lot of info that u can get through api.
for example:
echo 'Video: ' . $videoEntry->getVideoTitle() . "\n";
echo 'Video ID: ' . $videoEntry->getVideoId() . "\n";
echo 'Updated: ' . $videoEntry->getUpdated() . "\n";
echo 'Description: ' . $videoEntry->getVideoDescription() . "\n";
echo 'Category: ' . $videoEntry->getVideoCategory() . "\n";
echo 'Tags: ' . implode(", ", $videoEntry->getVideoTags()) . "\n";
echo 'Watch page: ' . $videoEntry->getVideoWatchPageUrl() . "\n";
echo 'Flash Player Url: ' . $videoEntry->getFlashPlayerUrl() . "\n";
echo 'Duration: ' . $videoEntry->getVideoDuration() . "\n";
echo 'View count: ' . $videoEntry->getVideoViewCount() . "\n";
echo 'Rating: ' . $videoEntry->getVideoRatingInfo() . "\n";
echo 'Geo Location: ' . $videoEntry->getVideoGeoLocation() . "\n";
echo 'Recorded on: ' . $videoEntry->getVideoRecorded() . "\n";
http://code.google.com/intl/en-EN/apis/youtube/2.0/developers_guide_php....
Comment | File | Size | Author |
---|---|---|---|
#3 | patch_commit_ab48ad911670.patch | 19.57 KB | jdelaune |
Comments
Comment #1
rhache CreditAttribution: rhache commentedyeah, that would be really useful. Doesn't have to be displayed by default. As long as the information was in the field items array you could then easily display what you want with a simple field template override.
Thanks,
Rene
Comment #2
jdelaune CreditAttribution: jdelaune commentedjec006 any ideas how we would tackle this? Add another serialised column in the database to hold a data array, then add a callback hook which fetches additional video data for that specific type and stores it in the database?
We would only be able expose this additional data in theme functions though. What do you think, have any better ideas for implementing this?
I'm happy to do the dirty work just wanted to see if you had any bright ideas.
Cheers
Comment #3
jdelaune CreditAttribution: jdelaune commentedNearly there I think.
- Adds a data database column.
- Provides a template file that can be overridden in your theme so you can use the data to display what you want.
- Other bits cleaned up here and there.
Example overridden template file:
Might need to re-work things for the colorbox side of things as well?
Comment #4
jdelaune CreditAttribution: jdelaune commentedComment #5
jec006 CreditAttribution: jec006 commentedHey, I'm sorry for the delay
Was thinking about it, but will review your patch and let you know if I have something better.
thanks again :)
Comment #6
theshanergy CreditAttribution: theshanergy commentedThis is awesome - any chance this data could be exposed to views as well?
Comment #7
jec006 CreditAttribution: jec006 commentedThanks as always jdelaune
Committed here: http://drupal.org/commitlog/commit/25834/3c2fbc23b0922b3c37eda8452831c6d...
and added a bit of stuff here: http://drupal.org/commitlog/commit/25834/080a6062a8dac586e2664839e3cc3af...
if you wouldn't mind checking that first commit, I had to do some hand merging because I updated a few things before reading your patch. I tested things and it all seems good, but let me know if I missed something.
As far as views integration: that would be sweet, however, right now the data is serialized and we don't really know what will be in it (as the providers can have different data) so I'm not sure how we'd go about showing views that data in a useful way.
It might be nice (though this is really ambitious) to add stuff to the settings to let you expose some of it. We'll have to see. Would you mind moving that to a new issue deckfifty?
Thanks everyone
Comment #9
ksiar CreditAttribution: ksiar commentedDoing that to display duration? Did anyone looked what data array contain?
$data['media$group']['media$content'][0]['duration']
Comment #10
ksiar CreditAttribution: ksiar commented+ An idea to put description value out of $embed_code. Now if I want to print description value before video, I have to modify field.tpl.php (or node template) and from there I can get the youtube values, so what is the point of this template file? Or am I doing smt wrong?
Comment #11
jdelaune CreditAttribution: jdelaune commentedThe description field is different because it's user modifiable. The description you get from YouTube or Vimeo etc isn't.
Comment #12
jec006 CreditAttribution: jec006 commentedComment #12.0
jec006 CreditAttribution: jec006 commentedlink added.