-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows MP3 files to be uploaded to the TGchat player - renames play internet sound #28575
base: master
Are you sure you want to change the base?
Conversation
I am once again requesting a TM. There's no way for me to know how well this performs without sending an MP3 to 50 or so real players |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code logick and syntax looks good.
return | ||
|
||
web_sound_input = tgui_input_text(src, "Enter content URL", "Play Internet Sound", null) | ||
if(!istext(web_sound_input) || !length(web_sound_input)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be something beside text if we get this from tgui-text-input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like if you hit the X button on the input instead of submit?
Nothing, it has no length, it'll return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I could get away with just !length
, CM was doing both !istext
and !length
here so copied it over to be safer than sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe !istext()
will be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opposite actually. !length
will return but !istext
will not return it if a blank input is sent
media_poll_request.prepare(RUSTG_HTTP_METHOD_GET, GLOB.configuration.system.ytdlp_url, json_encode(request_body)) | ||
// Start it off and wait | ||
media_poll_request.begin_async() | ||
UNTIL(media_poll_request.is_complete()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a complete noob, what will happen if we newer get an answer from server? Will we wait forever or will we fall into catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The web side of the code is mostly done by Affected and is unchanged from play internet sound
It'll runtime on into_response
and give you back a yt-dlp URL retrieval FAILED
error.
I think the only situation where this would happen is if the config is set and the ytdlp server is down... which shouldn't happen because the ytdlp server is hosted on the main server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. Than i feel like the rest of the logic will work fine.
if(web_sound_url) | ||
for(var/mob/M in GLOB.player_list) | ||
var/client/C = M.client | ||
var/this_uid = M.client.UID() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var/this_uid = M.client.UID() | |
var/player_uid = M.client.UID() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's Ready for TM
@warriorstar-orion would you be interested to give this one a look? Feels to me that you probably have necessary expertise. |
What Does This PR Do
A port of cmss13-devs/cmss13#4934
Renames
Play Internet Sound
toPlay Global Sound TGchat
.Allows MP3 files to be uploaded to the cached CDN webroot server and played back via the TGchat player
Doing this should significantly cut back on lag as now every client doesn't need to download a sound when played.
This is all assuming the CDN is properly set up and the config
asset_transport
is set towebroot
(as is required for the CDN to even function). The code defaults back to sending sound directly to clients if the CDN is down which lags all the same as the old proc. There's also an in-game warning for admins who try to upload an MP3 when the CDN is down.Playing web sounds still exists it's just wrapped into one proc now.
Part of me wants to nuke the old
Play Global Sound
proc and I might still do that after this is TM'd or verified to be working well...Play Global Sound TGchat
is kind of an awkward name.Why It's Good For The Game
Almost lag free uploading and playing back of sounds.
Images of changes
CDN server caching uploaded MP3

Testing
Uploaded a bunch of MP3s using the
localhost-asset-webroot-server.py
tool and tested the hell out of the procDeclaration
Changelog
🆑 bmon, fira
tweak: 'Play Internet Sounds' renamed to 'Play Global Sound TGchat'
add: MP3 files can now be played using the renamed 'Play Global Sound TGchat' for nearly lag free playback of sounds
/:cl: