external_video_url
Returns a link to the specified external video.
You can add specific parameters to the video link. The parameter names and related optional values should be the same as YouTuBe API.
media | external_video_url(attribute=any) returns string
Params
-
mediaobject: Media object
Hash Params
-
autoplayboolean: Whether to play automatically. Default isfalse -
controlsboolean: Whether to show player controls. Defaults totrue -
loopboolean: Whether to loop playback. Default isfalse
Example
Basic example
The generation of YouTube video player needs to be used in conjunction with external_video_tag.
{{#for media in product.media}}
{{#switch media.media_type}}
{{#case "external_video" /}}
{{#if media.host == "youtube"}}
{{#external_video_tag media | external_video_url(autoplay=false, loop=true) /}}
{{/if}}
{{/switch}}
{{/for}}
Was this article helpful to you?