Class: GuindillaGUI::AudioVideo
- Defined in:
- lib/guindilla_gui/guindilla_classes.rb
Overview
—————————————————————————-#
AudioVideo #
—————————————————————————-#
Instance Attribute Summary collapse
-
#state ⇒ Object
Returns the value of attribute state.
Attributes inherited from Element
Attributes inherited from Guindilla
#active_id, #blocks, #elements, #inputs, #socket
Instance Method Summary collapse
-
#initialize(type, attributes) ⇒ AudioVideo
constructor
A new instance of AudioVideo.
- #pause ⇒ Object
- #play ⇒ Object
- #volume=(vol) ⇒ Object
Methods inherited from Element
Methods inherited from Guindilla
#after, #alert, #align, #append, #attributes, #audio_out, #background, #border, #border_color, #border_radius, #border_width, #bullet_list, #button, #canvas, #chart, #checkbox, #circle, #color, #color_input, #container, #display, #every, #file_input, #font, #font_family, #font_size, #h_box, #h_rule, #heading, #height, #hide, #image, #justify, #line_break, #link, #margin, #move_to, #number_input, #on_click, #on_hover, #on_leave, #on_mouse_move, #opacity, #ordered_list, #padding, #para, #polygon, #radio_button, #range_slider, #rectangle, #rotate, #show, #size, #source, #square, #style, #sub_script, #sup_script, #text, #text_align, #text_input, #toggle, #transition, #triangle, #url_input, #v_box, #video_out, #web_frame, #width
Constructor Details
#initialize(type, attributes) ⇒ AudioVideo
Returns a new instance of AudioVideo.
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/guindilla_gui/guindilla_classes.rb', line 186 def initialize(type, attributes) super("#{type}") @state = "stopped" if attributes[:controls] == true send_js(%Q~ #{self.id}.controls = true; ~) end self.width = attributes[:width] if attributes[:width] self.height = attributes[:height] if attributes[:height] self.source = attributes[:source] if attributes[:source] end |
Instance Attribute Details
#state ⇒ Object
Returns the value of attribute state.
184 185 186 |
# File 'lib/guindilla_gui/guindilla_classes.rb', line 184 def state @state end |
Instance Method Details
#pause ⇒ Object
197 198 199 200 |
# File 'lib/guindilla_gui/guindilla_classes.rb', line 197 def pause send_js(%Q~ #{self.id}.pause(); ~) @state = "paused" end |
#play ⇒ Object
202 203 204 205 |
# File 'lib/guindilla_gui/guindilla_classes.rb', line 202 def play send_js(%Q~ #{self.id}.play(); ~) @state = "playing" end |
#volume=(vol) ⇒ Object
207 208 209 |
# File 'lib/guindilla_gui/guindilla_classes.rb', line 207 def volume=(vol) send_js(%Q~ #{self.id}.volume = #{vol}; ~) end |