Class: Scarpe::Webview::Video

Inherits:
Drawable show all
Defined in:
lib/scarpe/wv/video.rb

Constant Summary collapse

SUPPORTED_FORMATS =
{
  "video/mp4" => [".mp4"],
  "video/webp" => [".webp"],
  "video/quicktime" => [".mov"],
  "video/x-matroska" => [".mkv"],
  # Add more formats and their associated file extensions if needed
}.freeze
FORMAT_FOR_EXT =

Add more formats and their associated file extensions if needed

{}

Constants included from Shoes::Log

Shoes::Log::DEFAULT_COMPONENT, Shoes::Log::DEFAULT_DEBUG_LOG_CONFIG, Shoes::Log::DEFAULT_LOG_CONFIG

Instance Attribute Summary

Attributes inherited from Drawable

#children, #parent, #shoes_linkable_id

Attributes inherited from Shoes::Linkable

#linkable_id

Instance Method Summary collapse

Methods inherited from Drawable

#add_child, #bind, #destroy_self, display_class_for, #full_window_redraw!, #handler_js_code, #html_element, #html_id, #inspect, #needs_update!, #promise_update, #properties_changed, #remove_child, #set_parent, #shoes_styles, #to_html

Methods included from Shoes::Log

configure_logger, #log_init, logger

Methods inherited from Shoes::Linkable

#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_all_shoes_events, #unsub_shoes_event

Constructor Details

#initialize(properties) ⇒ Video

Returns a new instance of Video.



24
25
26
27
28
# File 'lib/scarpe/wv/video.rb', line 24

def initialize(properties)
  @url = properties[:url]
  super
  @format = FORMAT_FOR_EXT[File.extname(@url)]
end

Instance Method Details

#elementObject



30
31
32
# File 'lib/scarpe/wv/video.rb', line 30

def element
  render "video", shoes_styles.merge("format" => @format)
end