Class: Airplay::Viewer
- Inherits:
-
Object
- Object
- Airplay::Viewer
- Defined in:
- lib/airplay/viewer.rb
Overview
Public: The class to handle image broadcast to a device
Constant Summary collapse
- UnsupportedType =
Class.new(TypeError)
- TRANSITIONS =
%w(None Dissolve SlideLeft SlideRight)
Instance Method Summary collapse
-
#initialize(device) ⇒ Viewer
constructor
A new instance of Viewer.
-
#transitions ⇒ Object
Public: The list of transitions.
-
#view(media_or_io, options = {}) ⇒ Object
Public: Broadcasts the content to the device.
Constructor Details
Instance Method Details
#transitions ⇒ Object
Public: The list of transitions
Returns the list of trasitions
43 |
# File 'lib/airplay/viewer.rb', line 43 def transitions; TRANSITIONS end |
#view(media_or_io, options = {}) ⇒ Object
Public: Broadcasts the content to the device
media_or_io - The url, file path or io of the image/s options - Options that include the device
* transition: the type of transition (Default: None)
Returns if the images was actually sent
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/airplay/viewer.rb', line 24 def view(media_or_io, = {}) content = get_content(media_or_io) transition = .fetch(:transition, "None") @logger.info "Fetched content (#{content.bytesize} bytes)" @logger.debug "PUT /photo with transition: #{transition}" response = connection.put("/photo", content, { "Content-Length" => content.bytesize.to_s, "X-Apple-Transition" => transition }) response.response.status == 200 end |