Files
Paradise/code/modules/tgui/tgui_panel/audio.dm
Bm0n dc529f084f Allows MP3 files to be uploaded to the TGchat player - renames play internet sound (#28575)
* first commit

* review

* review again

* renames adds alert

* updates alert

---------

Co-authored-by: Bmon <no@email.com>
2025-07-06 21:45:32 +00:00

41 lines
897 B
Plaintext

/**
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
*/
/// Admin music volume, from 0 to 1.
/* check_grep:ignore */ /client/var/admin_music_volume = 1
/**
* public
*
* Sends music data to the browser.
*
* Optional settings:
* - pitch: the playback rate
* - start: the start time of the sound
* - end: when the musics stops playing
*
* required url string Must be an https URL.
* optional extra_data list Optional settings.
*/
/datum/tgui_panel/proc/play_music(url, extra_data)
if(!is_ready())
return
var/list/payload = list()
if(length(extra_data) > 0)
for(var/key in extra_data)
payload[key] = extra_data[key]
payload["url"] = url
window.send_message("audio/playMusic", payload)
/**
* public
*
* Stops playing music through the browser.
*/
/datum/tgui_panel/proc/stop_music()
if(!is_ready())
return
window.send_message("audio/stopMusic")