playStream: Difference between revisions
m (minor typo) |
No edit summary |
||
Line 50: | Line 50: | ||
Also note that dropbox no longer supports the "http" protocol, and only supports "https". If the "s" is omitted, the sound will not play. | Also note that dropbox no longer supports the "http" protocol, and only supports "https". If the "s" is omitted, the sound will not play. | ||
== Google Drive URLs == | |||
When you upload any file in Google Drive and share it, the shared link looks like this: | |||
<source lang="html"> | |||
https://drive.google.com/open?id=DRIVE_FILE_ID | |||
</source> | |||
The {{code|FILE_ID}} is unique for every file in Google Drive. If you copy this {{code|FILE_ID}} and use it as in the example URL below, you’ll get a direct link to download the file from Google Drive. | |||
<source lang="html"> | |||
https://drive.google.com/uc?export=download&id=DRIVE_FILE_ID | |||
</source> | |||
[https://www.labnol.org/internet/direct-links-for-google-drive/28356/ Info Source] | |||
== Technical Info == | == Technical Info == |
Revision as of 17:33, 1 May 2021
playStream() Function
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 orfile:/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.
Examples
[playStream(macro.args)]
To play the song, the GM can then use execLink:
[H: songUrl = "http://erinmcnamee.com.hostbaby.com/files/07_No_Sorrow__Banish_Misfortune.mp3"]
[H: audioByte = macroLinkText("playSong@Lib:MusicPlayer", "none", songUrl)]
[H: execLink(audioByte,0,"all")]
Alternatively, the GM can use execFunction:
[H: songUrl = json.append("[]","http://erinmcnamee.com.hostbaby.com/files/07_No_Sorrow__Banish_Misfortune.mp3")]
[H: execFunction("playStream", songUrl, 0, "all")
Dropbox URLs
After creating the dropbox share link you have to replace www.dropbox.com with dl.dropboxusercontent.com. That provides a direct link that playStream can use. Thanks to Full Bleed on the forums for the tip.
Also note that dropbox no longer supports the "http" protocol, and only supports "https". If the "s" is omitted, the sound will not play.
Google Drive URLs
When you upload any file in Google Drive and share it, the shared link looks like this:
https://drive.google.com/open?id=DRIVE_FILE_ID
The FILE_ID
is unique for every file in Google Drive. If you copy this FILE_ID
and use it as in the example URL below, you’ll get a direct link to download the file from Google Drive.
https://drive.google.com/uc?export=download&id=DRIVE_FILE_ID
Technical Info
The JavaFX docs provide more information about the supported media types. The MapTool macro functions only support the audio types.
[JavaFX Media Package]