Skip to content

Commit df1a5d2

Browse files
cweitkampConfectrician
authored andcommitted
Added 'playStream()' function (openhab#767)
- Added 'playStream()' function - Fixed linter errors Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
1 parent 9f32b6a commit df1a5d2

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

configuration/multimedia.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ The framework supports some base [functions](https://www.eclipse.org/smarthome/d
1313

1414
### Actions
1515

16-
-`setMasterVolume(float volume)` : Sets the volume of the host machine (volume in range 0-1)
17-
-`setMasterVolume(PercentType percent)` : Sets the volume of the host machine
18-
-`increaseMasterVolume(float percent)` : Increases the volume by the given percent
19-
-`decreaseMasterVolume(float percent)` : Decreases the volume by the given percent
20-
-`float getMasterVolume()` : Returns the current volume as a float between 0 and 1
16+
- `setMasterVolume(float volume)` : Sets the volume of the host machine (volume in range 0-1)
17+
- `setMasterVolume(PercentType percent)` : Sets the volume of the host machine
18+
- `increaseMasterVolume(float percent)` : Increases the volume by the given percent
19+
- `decreaseMasterVolume(float percent)` : Decreases the volume by the given percent
20+
- `float getMasterVolume()` : Returns the current volume as a float between 0 and 1
2121

2222
## Audio
2323

@@ -52,17 +52,32 @@ In order to play a sound, you can use the following command on the console:
5252

5353
```text
5454
openhab> smarthome:audio play doorbell.mp3
55+
56+
openhab> smarthome:audio stream example.com
5557
```
5658

5759
### Actions
5860

59-
Alternatively the [`playSound()` function](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/model/script/actions/Audio.html#playSound-java.lang.String-) can be used in DSL rules:
61+
Alternatively the [`playSound()`](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/model/script/actions/Audio.html#playSound-java.lang.String-) or [`playStream()`](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/model/script/actions/Audio.html#playStream-java.lang.String-) functions can be used in DSL rules:
62+
63+
- `playSound(String filename)` : plays a sound from the sounds folder to the default sink
64+
- `playSound(String filename, PercentType volume)` : plays a sound with the given volume from the sounds folder to the default sink
65+
- `playSound(String sink, String filename)` : plays a sound from the sounds folder to the given sink(s)
66+
- `playSound(String sink, String filename, PercentType volume)` : plays a sound with the given volume from the sounds folder to the given sink(s)
67+
68+
- `playStream(String url)` : plays an audio stream from an url to the default sink (set url to `null` if streaming should be stopped)
69+
- `playStream(String sink, String url)` : plays an audio stream from an url to the given sink(s) (set url to `null` if streaming should be stopped)
70+
71+
#### Examples
6072

6173
```java
6274
playSound("doorbell.mp3")
6375
playSound("doorbell.mp3", new PercentType(25))
6476
playSound("sonos:PLAY5:kitchen", "doorbell.mp3")
6577
playSound("sonos:PLAY5:kitchen", "doorbell.mp3", new PercentType(25))
78+
79+
playStream("example.com")
80+
playStream("sonos:PLAY5:kitchen", "example.com")
6681
```
6782

6883
## Voice
@@ -94,7 +109,7 @@ openhab> smarthome:voice say Hello world!
94109

95110
### Actions
96111

97-
Alternatively you can execute such commands within DSL rules by using the [`say()` function](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/core/voice/VoiceManager.html#say-java.lang.String-):
112+
Alternatively you can execute such commands within DSL rules by using the [`say()`](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/core/voice/VoiceManager.html#say-java.lang.String-) function:
98113

99114
```java
100115
say("Hello world!")
@@ -136,7 +151,7 @@ openhab> smarthome:voice interpret turn on the light
136151
The default human language interpreter will be used.
137152
In case of interpretation error, the error message will be said using the default voice and default audio sink.
138153

139-
Again, such a command can also be entered within DSL rules (using the [`interpret()` function](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/core/voice/VoiceManager.html#interpret-java.lang.String-))
154+
Again, such a command can also be entered within DSL rules (using the [`interpret()`](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/core/voice/VoiceManager.html#interpret-java.lang.String-) function)
140155

141156
```java
142157
interpret("turn on the light")

0 commit comments

Comments
 (0)