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.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI 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.
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) }}
To display the raw url of a remote video field in twig (Drupal 9):
{{ node.field_media.entity.field_media_oembed_video.0.value }}
to display the raw url of a remote video :
{{ content.field_media_oembed_video.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.