playStream: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 16: Line 16:
'''Parameter'''
'''Parameter'''
{{param|uri|The uri/url of the file, for example http://www.mywebsite/mysong.mp3 or file:///C:/mysong.mp3}}
{{param|uri|The uri/url of the file, for example http://www.mywebsite/mysong.mp3 or file:///C:/mysong.mp3}}
{{param|cycleCount|The number of times the audio should play. If set to `0`, the file is cached but not played; if set to `-1`, the file is played continuously. Defaults to 1.}}
{{param|cycleCount|The number of times the audio should play. If set to 0, the file is cached but not played; if set to -1, the file is played continuously. Defaults to 1.}}
{{param|volume|The volume the audio is to be played at. Can range from `0` to `1`. Defaults to 1.}}
{{param|volume|The volume the audio is to be played at. Can range from 0 to 1. Defaults to 1.}}
{{param|start|The time offset in seconds where audio should start playing, or restart from when repeating. Defaults to 0.}}
{{param|start|The time offset in seconds where audio should start playing, or restart from when repeating. Defaults to 0.}}
{{param|stop|The time offset where audio should stop playing or restart when repeating. Defaults to the end of the audio.}}
{{param|stop|The time offset where audio should stop playing or restart when repeating. Defaults to the end of the audio.}}

Revision as of 19:21, 10 September 2019

playStream() Function

Introduced in version 1.5.5
Play an audio stream for the current player, from an online source or from a local file. Can be disabled in the sound preferences. Multiple files can be played at the same time. If attempting to play the same audio file twice, the previous streaming is stopped.

Usage

playStream(uri)
playStream(uri, cycleCount)
playStream(uri, cycleCount, volume)
playStream(uri, cycleCount, volume, start)
playStream(uri, cycleCount, volume, start, stop)

Parameter

  • uri - The uri/url of the file, for example http://www.mywebsite/mysong.mp3 or file:///C:/mysong.mp3
  • cycleCount - The number of times the audio should play. If set to 0, the file is cached but not played; if set to -1, the file is played continuously. Defaults to 1.
  • volume - The volume the audio is to be played at. Can range from 0 to 1. Defaults to 1.
  • start - The time offset in seconds where audio should start playing, or restart from when repeating. Defaults to 0.
  • stop - The time offset where audio should stop playing or restart when repeating. Defaults to the end of the audio.