6

I have an entity reference field to Media Video.

I'm trying to get the uri to the video file in node template.

Most of the solution I found around is regarding Image/File. But not Video.

Tried Twig Field Value module but it doesn't work.

4 Answers 4

11
+50

If you use the media type Video installed by core, you'll find the URL in the field field_media_video_file:

{{ file_url(node.field_media.entity.field_media_video_file.entity.uri.value) }}
1

To display the raw url of a remote video field in twig (Drupal 9): {{ node.field_media.entity.field_media_oembed_video.0.value }}

0

to display the raw url of a remote video :

{{ content.field_media_oembed_video.0 }}
0
0

I obtained the raw url using the following.

content.field_video_link.0['#media'].field_media_oembed_video.0.value

Where field_video_link was my custom field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.