Hey, is there any way to get all the active sound channels, created by sound.PlayURL ? i made expression2 core that plays streams from URL. i attach the soundchannel to the entity, so when the entity gets removed, the channel stops playing.
but sometimes, caused by lag or lost data it keeps playing, and i have to wait until its done.
i searched the debug.getregistry, but didnt found anything useful. is there any way?
thanks.
push-
Come on, there are so many noobs that ask for useless darkrp stuff and they get instant answers.
Im asking something more difficult, and nobody got an answer for me?
There's no way.
That's not true.
One way you can go about it is like this.
[lua]
if SERVER then
util.AddNetworkString("StopStream")
function ENT:OnRemove()
net.Start("StopStream")
net.WriteEntity(self) -- What's our entity
net.Broadcast()
end
else
net.Receive("StopStream", function( l )
local ent = net.ReadEntity()
if ent.Radio:IsValid() then -- ent.Radio would be the Active Stream in this case
ent.Radio:Stop()
ent.Radio = nil
end
end)
end
[/lua]
You should be able to overwrite sound.PlayURL and store the resulting audio channel in a table after calling the old function.
[editline]5th January 2014[/editline]
[lua]local AudioChannels = {}
function sound.GetActiveChannels()
return AudioChannels
end
local PlayURL = sound.PlayURL
function sound.PlayURL( url, options, callback )
PlayURL( url, options, function( channel )
if channel then
table.insert( AudioChannels, channel )
end
callback( channel )
end)
end[/lua]
Of course, this doesn't actually remove channels that aren't playing, etc.
[QUOTE=Noi;45219705]Come on vinh, implement this.
[editline]26th June 2014[/editline]
It's annoying that there's no command to just stop all streams.[/QUOTE]
This isn't a place to request stuff.
I guess what Vinh could do is make "stopsound" also stop all streams.
[QUOTE=Noi;45220563]It's in dev discussions so it gets noticed sooner or later.[/QUOTE]
Good luck with that.
Sorry, you need to Log In to post a reply to this thread.