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. :)

Command icon 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

bgilhome created an issue. See original summary.

pierre-nono’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
StatusFileSize
new1.95 KB

Here 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.

jcisio’s picture

Status: Active » Needs work

Looks good for me. Just two small points:

  1. +++ b/modules/video_embed_media/src/Plugin/media/Source/VideoEmbedField.php
    @@ -134,6 +134,14 @@ class VideoEmbedField extends MediaSourceBase {
    +          if (method_exists($provider, 'getName')) {
    +            return $provider->getName();
    +          }
    

    $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.

  2. +++ b/modules/video_embed_media/src/Plugin/media/Source/VideoEmbedField.php
    @@ -149,6 +157,7 @@ class VideoEmbedField extends MediaSourceBase {
    +      'video_title' => $this->t('Gets the video title from source'),
    

    I'd prefer no verb. "Video title from source" would be better (like with "source_name").

pierre-nono’s picture

StatusFileSize
new1.87 KB

Okay, it's fix.
Here is the new patch.

pierre-nono’s picture

StatusFileSize
new1.87 KB
pierre-nono’s picture

StatusFileSize
new1.87 KB
nkoporec’s picture

Tested the latest patch, and it's working as expected.

nkoporec’s picture

Status: Needs work » Needs review

Tested the latest patch and it's working as expected.

nkoporec’s picture

Tested the patch and it's working as expected.

The last submitted patch, 5: retrieve-title-2913925-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 6: retrieve-title-2913925-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

pierre-nono’s picture

Okay, I see the problem, and two differents solutions for it.

In Drupal\Tests\video_embed_media\Kernel\DefaultNameTest.php ,

      'YouTube' => [
        'https://www.youtube.com/watch?v=gnERPdAiuSo',
        'YouTube Video (gnERPdAiuSo)',
      ],

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.

pierre-nono’s picture

Assigned: Unassigned » pierre-nono
Status: Needs work » Needs review
pierre-nono’s picture

StatusFileSize
new4.94 KB

I 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.

mgerbault’s picture

Another 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,status

beltofte’s picture

Updated 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.

rhristov’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #16 is working fine, changing status to RTBC.

jcisio’s picture

m_dimitris’s picture

I would like to ask where is this file located? I downloaded the module and there is not such a file and subfolder.
Thanks

hockey2112’s picture

Same here. Where are these directories? Is this patch no longer applicable top the current dev version of this module?

gurvan’s picture

StatusFileSize
new8.45 KB

@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

hockey2112’s picture

@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.

chris matthews’s picture

Assigned: pierre-nono » Unassigned
Parent issue: » #3095176: Plan for Video Embed Field 8.x-2.5 release
avpaderno’s picture

Status: Reviewed & tested by the community » Needs review

The last submitted patch, 16: retrieve-title-2913925-5.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

avpaderno’s picture

Status: Needs review » Needs work
jcisio’s picture

Status: Needs work » Needs review
StatusFileSize
new8.78 KB

Change the test case because the video used in test has been modified.

Status: Needs review » Needs work

The last submitted patch, 28: 2913925-28.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sam152’s picture

Status: Needs work » Closed (won't fix)

With 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.

joegl’s picture

Status: Closed (won't fix) » Needs work

The 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.

avpaderno’s picture

Title: Retrieve title & description for videos (D8) » Retrieve title and description for videos

mably made their first commit to this issue’s fork.

mably’s picture

Status: Needs work » Needs review

eric.guerin@ucsf.edu made their first commit to this issue’s fork.

karenann’s picture

Version: 8.x-2.x-dev » 3.0.0
StatusFileSize
new5.5 KB

I 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.