Thanks for reading,
I'm currently mucking around with sound.PlayURL for a jukebox on my server, but i've hit a few walls.
How do I check whether a sound has finished streaming? Currently the hud will display "You are listening to <song name>" but i can only make it dissapear on a button press. I would like to check whether the sound has finished.
How can i check the duration of a file / progress of the stream? e.g can I make it show the player "0m 38s/3m 20s" or something similar?
thanks
I don't think you can do anything other than pause or play the steam unless you use alternative methods to get this information and send it to the client. I think you can check if the sound is still playing by using the callback function. The last argument is a function that passes a variable which is the currently used sound channel for this. You can pass this argument to another function that allows you to access it so you can get it later and do an IsValid() check.
Something like this:
[code]
RadioSound = nil
sound.PlayURL("http://my.sound", "mono", function(mysound) if mysound:IsValid() then Radiosound = mysound end end)[/code]
Then later you can do like RadioSound:Stop()
All the functions you can apply to an audio channel are listed on [URL="http://wiki.garrysmod.com/page/Category:IGModAudioChannel"]the wiki.[/URL]
Oh thats still pretty neat, Thanks!
Sorry, you need to Log In to post a reply to this thread.