Class: Airplay::Browser
- Inherits:
-
Object
- Object
- Airplay::Browser
- Defined in:
- lib/airplay/browser.rb
Overview
Public: Browser class to find Airplay-enabled devices in the network
Constant Summary collapse
- NoDevicesFound =
Class.new(StandardError)
- SEARCH =
"_airplay._tcp."
Instance Method Summary collapse
-
#browse ⇒ Object
Public: Browses in the search of devices and adds them to the nodes.
-
#devices ⇒ Object
Public: Access to the node list.
-
#initialize ⇒ Browser
constructor
A new instance of Browser.
Constructor Details
Instance Method Details
#browse ⇒ Object
Public: Browses in the search of devices and adds them to the nodes
Returns nothing or raises NoDevicesFound if there are no devices
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/airplay/browser.rb', line 23 def browse timeout(5) do nodes = [] DNSSD.browse!(SEARCH) do |node| nodes << node next if node.flags.more_coming? nodes.each do |node| resolve(node) end break end end rescue Timeout::Error => e raise NoDevicesFound end |