Class: Airstream::Device
- Inherits:
-
Object
- Object
- Airstream::Device
- Defined in:
- lib/airstream/device.rb
Instance Attribute Summary collapse
-
#player ⇒ Object
readonly
Returns the value of attribute player.
-
#video_title ⇒ Object
readonly
Returns the value of attribute video_title.
Instance Method Summary collapse
- #block_while_loading ⇒ Object
- #duration ⇒ Object
- #file=(file) ⇒ Object
- #image=(image_file) ⇒ Object
-
#initialize(receiver) ⇒ Device
constructor
A new instance of Device.
- #pause ⇒ Object
- #position ⇒ Object
- #resume ⇒ Object
- #scrub(seconds = nil) ⇒ Object
- #video=(video) ⇒ Object
Constructor Details
#initialize(receiver) ⇒ Device
Returns a new instance of Device.
8 9 10 |
# File 'lib/airstream/device.rb', line 8 def initialize(receiver) @receiver = receiver end |
Instance Attribute Details
#player ⇒ Object (readonly)
Returns the value of attribute player.
6 7 8 |
# File 'lib/airstream/device.rb', line 6 def player @player end |
#video_title ⇒ Object (readonly)
Returns the value of attribute video_title.
6 7 8 |
# File 'lib/airstream/device.rb', line 6 def video_title @video_title end |
Instance Method Details
#block_while_loading ⇒ Object
23 24 25 |
# File 'lib/airstream/device.rb', line 23 def block_while_loading sleep 0.2 until position != 0 end |
#duration ⇒ Object
48 49 50 |
# File 'lib/airstream/device.rb', line 48 def duration self.scrub["duration"] end |
#file=(file) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/airstream/device.rb', line 12 def file=(file) if file.class == Video self.video = file # when # TODO Image then self.image = file else raise "Unknown file type send to device" end block_while_loading end |
#image=(image_file) ⇒ Object
27 28 29 |
# File 'lib/airstream/device.rb', line 27 def image=(image_file) @receiver.send_image image_file end |
#pause ⇒ Object
36 37 38 |
# File 'lib/airstream/device.rb', line 36 def pause @player.pause end |
#position ⇒ Object
52 53 54 |
# File 'lib/airstream/device.rb', line 52 def position self.scrub["position"] end |
#resume ⇒ Object
40 41 42 |
# File 'lib/airstream/device.rb', line 40 def resume @player.resume end |
#scrub(seconds = nil) ⇒ Object
44 45 46 |
# File 'lib/airstream/device.rb', line 44 def scrub(seconds=nil) @player.scrub seconds end |
#video=(video) ⇒ Object
31 32 33 34 |
# File 'lib/airstream/device.rb', line 31 def video=(video) @player = @receiver.send_video video.url @video_title = video.to_s end |