Class: Foliokit::Overlay::OverlayVideo

Inherits:
OverlayBase show all
Defined in:
lib/foliokit/overlay/overlay_video.rb

Instance Attribute Summary

Attributes inherited from OverlayBase

#section_index, #state

Instance Method Summary collapse

Methods inherited from OverlayBase

element_base, #initialize, #stateful?

Methods included from Modules::Element

#initialize

Constructor Details

This class inherits a constructor from Foliokit::Overlay::OverlayBase

Instance Method Details

#export(document, options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/foliokit/overlay/overlay_video.rb', line 17

def export(document, options = {})
  node = super(document, options)

  # process youtube videos
  uri = Addressable::URI.parse(video_url)
  if uri.absolute? and uri.host =~ /(youtube)/
    node["touchable"] = true
    node["data-type"] = "youtube"
    node["data-src"] = uri.to_s
    node["class"] = "overlay-webview"
    return node
  end

  node["src"] = package.store_asset(video_url)
  node["auto-start"] = auto_start
  node["loop"] = hide_when_finished_playing
  node["fullscreen"] = play_in_context ? false : true
  node["playsinline"] = "playsinline" if play_in_context
  node["controls"] = true if show_controls_by_default
  node["swipable"] = true
  node["touchable"] = true
  node
end

#tagnameObject



13
14
15
# File 'lib/foliokit/overlay/overlay_video.rb', line 13

def tagname
  "div"
end