Class: VideojsRails::Tags::Video

Inherits:
Tag
  • Object
show all
Defined in:
lib/videojs_rails/tags/video.rb

Constant Summary collapse

DEFAULT_LANGUAGE_KEY =
:default_caption_language
DEFAULT_OPTIONS =
{
  controls: true,
  preload: :auto
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(options, &no_js) ⇒ Video

Returns a new instance of Video.



10
11
12
13
# File 'lib/videojs_rails/tags/video.rb', line 10

def initialize(options, &no_js)
  @no_js = no_js
  prepare_options(options)
end

Instance Method Details

#to_htmlObject



15
16
17
18
19
20
21
# File 'lib/videojs_rails/tags/video.rb', line 15

def to_html
  (:video, options) do
    sources.each {|type, options| concat Source.new(type, options).to_html }
    captions.each {|lang, options| concat Caption.new(lang, default_caption_language, options).to_html }
    generate_no_js
  end
end