All pages
Powered by GitBook
1 of 1

Loading...

SSceneBackgroundMusic

Index

Functions Index

Function Name

Properties Index

Property Name

Functions

Play

void Play ()

Plays the radio stream

PlayMP3Stream

void PlayMP3Stream (string url)

Sets the given MP3 stream url as current stream

Parameter
Type
Description

PlayVorbisStream

void PlayVorbisStream (string url)

Sets the given Vorbis stream url as current stream

Parameter
Type
Description

Stop

void Stop ()

Stops playing the radio stream

OnTrackChange

void OnTrackChange (Closure o) void OnTrackChange (Action< > trackInfoCallback)

Function will be called when track changes.

Parameter
Type
Description

OnUpcomingTrackChange

void OnUpcomingTrackChange (Closure o) void OnUpcomingTrackChange (Action< > trackInfoCallback)

Function will be called when there's an upcoming track change

Parameter
Type
Description

Properties

Enabled

bool Enabled get set

Is this component Enabled?

URL

string URL get

URL of the current stream

GameObject

GameObject get

Property Description

void Play ()

void PlayMP3Stream (string url)

void PlayVorbisStream (string url)

void Stop ()

void OnTrackChange (Closure o) void OnTrackChange (Action< STrackInfo > trackInfoCallback)

void OnUpcomingTrackChange (Closure o) void OnUpcomingTrackChange (Action< STrackInfo > trackInfoCallback)

bool Enabled get set

string URL get

SGameObject GameObject get

STrackInfo
STrackInfo
SGameObject
Space.Host.ExecutingObject.Radio.Play()
 --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.ExecutingObject
IsPlaying = false


StartPlaying = function()
thisGameObject.Radio.Play()
IsPlaying = true
end

StopPlaying = function()
thisGameObject.Radio.Stop()
IsPlaying = false
end


OnClick = function()
    if IsPlaying then
      StopPlaying()
    else
      StartPlaying()
    end
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Toggle Play/Stop"
thisGameObject.Clickable.OnClick(OnClick) 
Space.Host.ExecutingObject.Radio.PlayMP3Stream("http://stream.example.org:1234/")
Space.Host.ExecutingObject.Radio.PlayVorbisStream("http://stream.example.org:1234/")
Space.Host.ExecutingObject.Radio.Stop()
--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.ExecutingObject
IsPlaying = false


StartPlaying = function()
thisGameObject.Radio.Play()
IsPlaying = true
end

StopPlaying = function()
thisGameObject.Radio.Stop()
IsPlaying = false
end


OnClick = function()
    if IsPlaying then
      StopPlaying()
    else
      StartPlaying()
    end
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Toggle Play/Stop"
thisGameObject.Clickable.OnClick(OnClick)
otc = function(trackInfo)
  end
Space.Host.ExecutingObject.Radio.OnTrackChange(otc)
--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.ExecutingObject

text = Space.Host.GetReference("Text") -- set in Scripting Runtime references

otc = function(trackInfo)
text.UIText.Text = "Track: " .. trackInfo.Title .. " by " .. trackInfo.Artist
end

thisObj.Radio.OnTrackChange(otc)
otc = function(trackInfo)

end
Space.Host.ExecutingObject.Radio.OnUpcomingTrackChange(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.ExecutingObject

text = Space.Host.GetReference("Text") -- set in Scripting Runtime references

outc = function(upcomingTrackInfo)
text.UIText.Text = "Track: " .. upcomingTrackInfo.Title .. " by " .. upcomingTrackInfo.Artist
end

thisObj.Radio.OnUpcomingTrackChange(outc)
Space.Host.ExecutingObject.Radio.Enabled = true
--clicking this object will Enable/Disable it's Scene Background Music component
thisGameObject = Space.Host.ExecutingObject
component = thisGameObject.Radio

OnClick = function()
component.Enabled =  not component.Enabled
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
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.ExecutingObject

text = Space.Host.GetReference("Text") -- set in Scripting Runtime references


OnUpdate = function()
text.UIText.Text = thisObj.Radio.URL
end

thisObj.OnUpdate(OnUpdate)
theGameObject = Space.Host.ExecutingObject.Floor.GameObject