View Source VideoLinkHelper (video_link_helper v0.3.0)
A helper for extracting IDs from video (Youtube or Vimeo) URLs and rendering embeds for those IDs.
Summary
Functions
create_vimeo_embed(id, height, width)
deprecated
create_youtube_embed(id, height, width)
deprecated
Extracts an ID from a link and identifies it as either a Youtube or Vimeo link.
Renders HTML for a video embed.
Functions
This function is deprecated. Use VideoLinkHelper.render_embed/2 instead..
This function is deprecated. Use VideoLinkHelper.render_embed/2 instead..
Extracts an ID from a link and identifies it as either a Youtube or Vimeo link.
Examples
iex> VideoLinkHelper.extract_id("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
{:youtube, "dQw4w9WgXcQ"}
Renders HTML for a video embed.
Options
:width
- Width of the video embed. Default is 560.:height
- Height of the video embed. Default is 315.:video_type
- The type of video embed to render. Must be either:youtube
or:vimeo
. If this option is not provided, the default is:youtube
.
Returns a string.