Module: VideoTag

Defined in:
lib/textile_tags.rb

Instance Method Summary collapse

Instance Method Details

#vid(opts) ⇒ Object



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

def vid(opts)
  dimensions, video_url, image_url = opts[:text].split("\n").map { |x| x.strip.chomp("<br />") }
  width, height = dimensions.split(',').map { |x| x.strip.chomp("<br />") }
  %{
    <div
      id="#{opts[:id]}"
      class="player center"
      href="#{video_url}"
      style="width:#{width};height:#{height};background-image:url(#{image_url})">
      <span></span>
      <img class="play" src="/images/play.png" />
    </div>

    <script type="text/javascript" src="/js/flowplayer-3.2.4.min.js"></script>
    <script type="text/javascript">
      flowplayer("#{opts[:id]}", "http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf");
    </script>
  }
end