--this script will let us click a radio to make it start playing--(Example: clicking a light switch toggle's a parent light bulb's intensity)--[Requires a "Shoutcast Streaming" component on the parent of this object]thisGameObject = Space.Host.ExecutingObjectIsPlaying =falseStartPlaying=function()thisGameObject.Radio.Play()IsPlaying =trueendStopPlaying=function()thisGameObject.Radio.Stop()IsPlaying =falseendOnClick=function()if IsPlaying thenStopPlaying()elseStartPlaying()endendthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip="Toggle Play/Stop"thisGameObject.Clickable.OnClick(OnClick)
--this script will let us click a radio to make it start playing--(Example: clicking a light switch toggle's a parent light bulb's intensity)--[Requires a "Shoutcast Streaming" component on the parent of this object]thisGameObject = Space.Host.ExecutingObjectIsPlaying =falseStartPlaying=function()thisGameObject.Radio.Play()IsPlaying =trueendStopPlaying=function()thisGameObject.Radio.Stop()IsPlaying =falseendOnClick=function()if IsPlaying thenStopPlaying()elseStartPlaying()endendthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip="Toggle Play/Stop"thisGameObject.Clickable.OnClick(OnClick)
--this script will update a UIText object with the track title on track change--[this GameObject needs a "Shoutcast Streaming"/"SceneBackgroundMusic" component]thisObj = Space.Host.ExecutingObjecttext = Space.Host.GetReference("Text") -- set in Scripting Runtime referencesotc=function(trackInfo)text.UIText.Text ="Track: " .. trackInfo.Title .." by " .. trackInfo.ArtistendthisObj.Radio.OnTrackChange(otc)
--this script will update a UIText object with the track title on upcoming track change--[this GameObject needs a "Shoutcast Streaming"/"SceneBackgroundMusic" component]thisObj = Space.Host.ExecutingObjecttext = Space.Host.GetReference("Text") -- set in Scripting Runtime referencesoutc=function(upcomingTrackInfo)text.UIText.Text ="Track: " .. upcomingTrackInfo.Title .." by " .. upcomingTrackInfo.ArtistendthisObj.Radio.OnUpcomingTrackChange(outc)
Properties
Enabled
bool Enabledgetset
Is this component Enabled?
Space.Host.ExecutingObject.Radio.Enabled =true
--clicking this object will Enable/Disable it's Scene Background Music componentthisGameObject = Space.Host.ExecutingObjectcomponent = thisGameObject.RadioOnClick=function()component.Enabled =not component.EnabledendthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
URL
string URLget
URL of the current stream
streamURL = Space.Host.ExecutingObject.Radio.URL
--this script will update a UIText object with the current stream URL--[this GameObject needs a "Shoutcast Streaming"/"SceneBackgroundMusic" component]thisObj = Space.Host.ExecutingObjecttext = Space.Host.GetReference("Text") -- set in Scripting Runtime referencesOnUpdate=function()text.UIText.Text = thisObj.Radio.URLendthisObj.OnUpdate(OnUpdate)