Module: ViewHelpers

Defined in:
lib/embeddable/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#embed_video(embeddable, width, height) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/embeddable/view_helpers.rb', line 2

def embed_video(embeddable, width, height)
  attributes = { id: embeddable.video_id, width: width, height: height }

  if embeddable.video_on_youtube?
    render 'embeddable/partials/youtube', attributes
  elsif embeddable.video_on_vimeo?
    render 'embeddable/partials/vimeo', attributes
  elsif embeddable.video_on_dailymotion?
    render 'embeddable/partials/dailymotion', attributes
  elsif embeddable.video_on_veoh?
    render 'embeddable/partials/veoh', attributes
  elsif embeddable.video_on_vippy?
    render 'embeddable/partials/vippy', attributes
  elsif embeddable.video_on_liveleak?
    # not supported
    link_to embeddable.url, embeddable.url
  elsif embeddable.video_on_brightcove?
    render 'embeddable/partials/brightcove', attributes
  else
    link_to embeddable.url, embeddable.url
  end
end