It'd be a useful feature to obtain video title & description from the remote source, like the D7 version. For Vimeo, this can be obtained from the oEmbed data, and for Youtube, the title can also be obtained from oEmbed via https://www.youtube.com/oembed?url= however it seems the description requires use of the Youtube API - https://www.drupal.org/project/youtubeapi could be leveraged.
Perhaps similar to https://www.drupal.org/node/2908011 we could add a public method to providers eg. getRemoteData() to return an array of obtainable data (oEmbed data for vimeo and API data for YouTube)?
I can get around to writing this and making a patch but likely not within the next month - if anyone wanted to jump on it earlier go ahead. :)
| Comment | File | Size | Author |
|---|---|---|---|
| #37 | retrieve-title-2913925-37.patch | 5.5 KB | karenann |
| #28 | 2913925-28.patch | 8.78 KB | jcisio |
| #21 | retrieve-title-2913925-6.patch | 8.45 KB | gurvan |
| #16 | retrieve-title-2913925-5.patch | 6.9 KB | beltofte |
| #14 | retrieve-title-2913925-4.patch | 4.94 KB | pierre-nono |
Issue fork video_embed_field-2913925
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pierre-nono commentedHere is the patch, but it's not for the 1.x-dev but the 2.x-dev (with Media from Core 8.4^).
And it's only for the title.
Hoping you will find it useful.
Comment #3
jcisio commentedLooks good for me. Just two small points:
$provider must implement \Drupal\video_embed_field\ProviderPluginInterface and it is a guarantee for the existance of getName(). There is no need for this check.
I'd prefer no verb. "Video title from source" would be better (like with "source_name").
Comment #4
pierre-nono commentedOkay, it's fix.
Here is the new patch.
Comment #5
pierre-nono commentedComment #6
pierre-nono commentedComment #7
nkoporecTested the latest patch, and it's working as expected.
Comment #8
nkoporecTested the latest patch and it's working as expected.
Comment #9
nkoporecTested the patch and it's working as expected.
Comment #12
pierre-nono commentedOkay, I see the problem, and two differents solutions for it.
In Drupal\Tests\video_embed_media\Kernel\DefaultNameTest.php ,
We change it for "DrupalCon Austin 2014: Keynote: Dries Buytaert", adopting the same approach as Vimeo provider.
Or we don't implement a getName() method in Youtube Provider, but a different one (something like getTitle), to not get mixed up.
But this need to change the Vimeo provider to add another method, which will be a doublon (or re-use) the getName method.
Comment #13
pierre-nono commentedComment #14
pierre-nono commentedI go more for the second option, and implement a getDefaultName() and a getName() methods in the ProviderPluginBase.
I also modified a little the tests to adapt them.
Comment #15
mgerbaultAnother idea to get Description on Youtube video :
https://www.googleapis.com/youtube/v3
Example :
https://www.googleapis.com/youtube/v3/videos?id={ID_VIDEO}&key={YOUR_API_KEY}&part=snippet,contentDetails,statistics,statusComment #16
beltofteUpdated the patch to also support retrieving the description.
Right now is it only retrieving from Vimeo due to Youtube not including description in their oembed endpoint. It could be retrieved using their API, as mentioned by mgerbault, but that will require another form / UI where the Youtube API key can be configured.
Added a related issue retrieving duration, which is also not possible in the Youtube oembed endpoint. We might want to create a separate follow up issue adding the Youtube API support and configuration.
Comment #17
rhristov commentedPatch from #16 is working fine, changing status to RTBC.
Comment #18
jcisio commentedFollow-up #3001487: Using YouTube API for metadata for API use.
Comment #19
m_dimitris commentedI would like to ask where is this file located? I downloaded the module and there is not such a file and subfolder.
Thanks
Comment #20
hockey2112 commentedSame here. Where are these directories? Is this patch no longer applicable top the current dev version of this module?
Comment #21
gurvan commented@m_dimitris @hockey2112 The patch is working for the 8.x-2.x branch
I've create a new patch that also fix this issue "Provide title attribute in iframe tag for accessibility" by adding a new title attribute to the iframe
Comment #22
gurvan commentedComment #23
hockey2112 commented@gurvan, I have successfully applied the patch... how can I display the video title via the field display config, or via a View? I'd like to display the thumbnail (clickable with Colorbox), and the video title underneath the thumbnail. My provider is Vimeo.
Comment #24
chris matthews commentedComment #25
avpadernoComment #27
avpadernoComment #28
jcisio commentedChange the test case because the video used in test has been modified.
Comment #30
sam152 commentedWith the advent of Media in core, the Video Embed Field module has moved to being minimally maintained. Only issues which assist in the migration to Media in core will be committed. To read more about this decision, please see: #3089599: Maintenance status for Video Embed Field now that media is in core.
Comment #31
joegl commentedThe latest releases break the patch we were using from this issue. It was closed because the module was no longer being updated with new features, however that doesn't seem to be the case anymore. Can we re-open this issue then? Is this still relevant? I have not had time to investigate how critical the patch is to the codebase I'm supporting, and the use of the patch predates my time. Apologies if I'm just adding more noise and if/when I do get time to investigate more I'll update.
Comment #32
avpadernoComment #35
mably commentedComment #37
karenann commentedI attempted to reroll the 2913925-28.patch in #28 for Video Embed Field 3.0.0. In this, some of the changes were already present in 3.0.0 and I didn't roll over any getDefaultName stuff.
I have NOT tested this AT ALL and so no guarantees it works and doesn't break stuff. I see that "patch files are no longer recommended, use merge requests instead" but I haven't made the jump to that yet and I figure others may not have either. I will look at that next; time allowing.