Class: Scarpe::WebviewVideo
- Inherits:
-
WebviewWidget
- Object
- Shoes::Linkable
- WebviewWidget
- Scarpe::WebviewVideo
- 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
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 WebviewWidget
#children, #parent, #shoes_linkable_id
Attributes inherited from Shoes::Linkable
Instance Method Summary collapse
- #element ⇒ Object
-
#initialize(properties) ⇒ WebviewVideo
constructor
A new instance of WebviewVideo.
Methods inherited from WebviewWidget
#add_child, #bind, #destroy_self, display_class_for, #handler_js_code, #html_element, #html_id, #inspect, #needs_update!, #promise_update, #properties_changed, #remove_child, #rgb_to_hex, #set_parent, #style, #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_shoes_event
Constructor Details
#initialize(properties) ⇒ WebviewVideo
13 14 15 16 |
# File 'lib/scarpe/wv/video.rb', line 13 def initialize(properties) @url = properties[:url] super end |
Instance Method Details
#element ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/scarpe/wv/video.rb', line 18 def element HTML.render do |h| h.video(id: html_id, style: style, controls: true) do supported_formats.each do |format| h.source(src: @url, type: format) end end end end |