-
Notifications
You must be signed in to change notification settings - Fork 12
music
The following functions, constants and structures allow you to use the Steam Music API.
These functions are provided for getting and setting the media player playback:
- steam_music_is_enabled
- steam_music_is_playing
- steam_music_get_status
- steam_music_play
- steam_music_pause
- steam_music_play_next
- steam_music_play_previous
- steam_music_set_volume
These are the constants used by this API:
This function returns whether Steam music is enabled.
Syntax:
steam_music_is_enabled()
Returns:
Example:
global.steam_music_enabled = steam_music_is_enabled();
The above code gets if Steam music player is enabled and stores the result in a global variable.
This function returns whether Steam music is playing.
Note
This function returns true even if a track is paused.
Syntax:
steam_music_is_playing()
Returns:
Example:
global.steam_music_playing = steam_music_is_playing();
The above code gets if the Steam music player is playing and stores the result in a global variable.
This function gets the current status of the media player as SteamMusicStatus.
Syntax:
steam_music_get_status()
Returns:
Example:
if (steam_music_get_status == steam_music_playing) {
steam_music_pause();
}
The above code gets if the Steam music player is playing. If it is, it pauses the playback.
This function resumes playback of the current track. Returns true
if successful.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.
Syntax:
steam_music_play()
Returns:
Triggers:
Key | Type | Description |
---|---|---|
event_type | String | The string value "steam_music_playback_status_has_changed"
|
This function pauses the current track. Returns true
if successful.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.
Syntax:
steam_music_pause()
Returns:
Triggers:
Key | Type | Description |
---|---|---|
event_type | String | The string value "steam_music_playback_status_has_changed"
|
This function plays the next track. If the current track is the last, it loops to the first one. Returns true
if successful.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.
Syntax:
steam_music_play_next()
Returns:
Triggers:
Key | Type | Description |
---|---|---|
event_type | String | The string value "playback_status_has_changed"
|
This function plays the previous track. It resets the current track first, and goes to the last one if called again.
If the current track is the first, it DOES NOT loop to the last one. Returns true
if successful.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.
Syntax:
steam_music_play_previous()
Returns:
Triggers:
Key | Type | Description |
---|---|---|
event_type | String | The string value "steam_music_playback_status_has_changed"
|
This function sets the volume of Steam music player only (not the system volume).
If a number higher than 1 is entered, it defaults to 1. Returns true
if successful.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.
Syntax:
steam_music_set_volume(volume)
Argument | Type | Description |
---|---|---|
volume | Real | The volume that you want to set as a real. |
Returns:
N/A
Triggers:
This callback is triggered whenever the volume is changed via the Steam client UI.
Key | Type | Description |
---|---|---|
event_type | String | The string value "steam_music_volume_has_changed"
|
volume | Real | The current volume of the music player |
These constants represent the status of the music player.
Member | Description |
---|---|
steam_music_playback_undefined |
0 |
steam_music_playback_playing |
1 |
steam_music_playback_paused |
2 |
steam_music_playback_idle |
3 |
GameMaker 2024