Class: OpenHAB::Core::Actions::Audio
- Inherits:
-
Object
- Object
- OpenHAB::Core::Actions::Audio
- Defined in:
- lib/openhab/core/actions/audio.rb,
lib/openhab/rspec/openhab/core/actions.rb
Overview
Class Method Summary collapse
-
.play_sound(filename, sink: nil, volume: nil) ⇒ void
Play an audio file via openHAB sound service, Audio.playSound().
-
.play_stream(url, sink: nil) ⇒ void
Play an audio stream from an URL to the given sink(s).
Class Method Details
.play_sound(filename, sink: nil, volume: nil) ⇒ void
This method returns an undefined value.
Play an audio file via openHAB sound service, Audio.playSound()
24 25 26 27 28 29 30 31 |
# File 'lib/openhab/core/actions/audio.rb', line 24 def play_sound(filename, sink: nil, volume: nil) volume = PercentType.new(volume) unless volume.is_a?(PercentType) || volume.nil? java_send :playSound, [java.lang.String, java.lang.String, PercentType.java_class], sink, filename.to_s, volume end |
.play_stream(url, sink: nil) ⇒ void
This method returns an undefined value.
Play an audio stream from an URL to the given sink(s). Set url to nil if streaming should be stopped
44 45 46 |
# File 'lib/openhab/core/actions/audio.rb', line 44 def play_stream(url, sink: nil) playStream(sink&.to_s, url) end |