class Airplay::Group
Public Class Methods
new(name)
click to toggle source
# File lib/airplay/group.rb, line 11 def initialize(name) @devices = [] @players = [] @name = name end
Public Instance Methods
<<(device)
click to toggle source
Public: Adds a device to the list
value - The Device
Returns nothing
# File lib/airplay/group.rb, line 23 def <<(device) @devices << device end
play(file_or_url, options = {})
click to toggle source
Public: Plays a video on all the grouped devices
file_or_url - The file or url to be sent to the devices options - The options to be sent
Returns a Players
instance that syncs the devices
# File lib/airplay/group.rb, line 34 def play(file_or_url, options = {}) @players = @devices.map { |device| device.play(file_or_url, options) } Players.new(@players) end
view(media_or_io, options = {})
click to toggle source
Public: Views an image on all the grouped devices
media_or_io - The file or url to be sent to the devices options - The options to be sent
Returns an array of arrays with the result of the playback
# File lib/airplay/group.rb, line 46 def view(media_or_io, options = {}) @devices.map do |device| ok = device.view(media_or_io, options) [device, ok] end end