Coder Social home page Coder Social logo

vurv78 / webaudio Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 3.0 459 KB

A safe, efficient and powerful replacement for Streamcore that adds playing & manipulating URL streams through IGmodAudioChannel/BASS

Home Page: https://steamcommunity.com/sharedfiles/filedetails/?id=2466875474

License: MIT License

Lua 100.00%
garrysmod wiremod expression2 streamcore webaudio glua gmod garrys workshop bass

webaudio's Introduction

WebAudio Release Shield License Linter Badge github/Vurv78 Workshop Subscribers

This is an addon for garrysmod that adds a serverside WebAudio class which can be used to interact with clientside IGmodAudioChannels asynchronously.
It also adds an extension for Expression2 to interact with these in a safe manner.

You can consider this as a safe and more robust replacement for the popular Streamcore addon, and I advise you to replace it for the safety of your server and its population. Documentation can be found at the bottom of this file

To convert your Streamcore contraptions to WebAudio, see from Streamcore to WebAudio

Features

  • Client and Serverside Whitelists, both are customizable with simple patterns or more advanced lua patterns.
  • The WebAudio class and api for that allows for interfacing with IGModAudioChannels from the server, changing the volume, position and time of the audio streams dynamically.
    • Comes with an Expression2 type that binds to the WebAudio lua class.

Why use this over streamcore

If you do not know already, Streamcore is a dangerous addon in several ways.

  • Allows for ANYONE to download ANYTHING to everyone on the server's computers.
  • Allows for people to crash / lag everyone easily.
  • Doesn't allow you to disable it. (There is apparently a way to disable streamcore through streamcore_disabled. It was added ~4 years after the addon was created only after people kept bugging the creator that maybe it isn't a good idea to allow people to download ANYTHING to your computer with no shut off switch.)

WebAudio aims to easily solve these issues by:

  • Having proper net limits
  • Using a customizable whitelist for both your server & its clients.
  • Containing a flexible but safe default whitelist that only allows for large or trusted domains as to not allow for malicious requests.

Contributing

See CONTRIBUTING.md

Convars

Realm Name Default Value Description
SHARED wa_enable 1 Whether WebAudio is enabled for you or the whole server. If you set this to 0, it will purge all currently running streams
SERVER wa_admin_only 0 Restrict E2 WebAudio access to admins. 0 is everyone, 1 is >=admin, 2 is super admins only.
SERVER wa_stream_max 5 Max number of E2 WebAudio streams a player can have
SHARED wa_volume_max 300 Max volume of streams, will clamp the volume of streams to this on both the client and on the server
SHARED wa_radius_max 3000 Max distance where WebAudio streams can be heard from their origin.
SHARED wa_fft_enable 1 Whether FFT data is enabled for the server / your client. You shouldn't need to disable it as it is very lightweight
CLIENT wa_verbosity 1 Verbosity of console notifications. 2 => URL/Logging + Extra Info, 1 => Only warnings/errors, 0 => Nothing (Avoid this)
SERVER wa_sc_compat 0 Whether streamcore-compatible functions should be generated for E2 (for backwards compat)

Concommands

Realm Name Description
SHARED wa_purge Purges all currently running WebAudio streams and does not receive any further net updates with their objects.
SHARED wa_reload_whitelist Refreshes your whitelist located at data/webaudio_whitelist.txt
SHARED wa_list Prints a list of currently playing WebAudio streams (As long as their owner IsValid) with their url, id & owner
SHARED wa_help Prints the link to the github to your console
CLIENT wa_display Displays active WebAudio streams to your screen w/ steamid and stream id

Functions

webaudio webAudio(string url)
Returns a WebAudio object of that URL as long as it is whitelisted by the server.
Has a burst cooldown between calls. If you can't create a webAudio object, it'll error, so check webAudioCanCreate before calling this! You can create all of your streams in one tick but will have to wait 300ms for each slot to regenerate.

number webAudiosLeft()
Returns how many WebAudios you can create.

number webAudioCanCreate()
Returns whether you can create a webaudio stream. Checks cooldown and whether you have a slot for another stream left.

number webAudioCanCreate(string url)
Same as webAudioCanCreate(), but also checks if the url given is whitelisted so you don't error on webAudio calls.

number webAudioEnabled()
Returns whether webAudio is enabled for use on the server.

number webAudioAdminOnly()
Returns 0 if webAudio is available to everyone, 1 if only admins, 2 if only superadmins.

WebAudio Type Methods

Setters

void webaudio:setDirection(vector dir)
Sets the direction in which the WebAudio stream is playing towards. Does not update the object.

void webaudio:setPos(vector pos)
Sets the 3D Position of the WebAudio stream without updating it. Does not update the object.

void webaudio:setVolume(number volume)
Sets the volume of the WebAudio stream, in percent format. 200 is 2x as loud as normal, 100 is default. Will error if it is past wa_volume_max.

void webaudio:setTime(number time)
Sets the time in which the WebAudio stream should seek to in playing the URL. Does not update the object.

void webaudio:setPlaybackRate(number rate)
Sets the playback speed of a webaudio stream. 2 is twice as fast, 0.5 being half, etc. Does not update the object.

void webaudio:setParent(entity e)
Parents the stream position to e, local to the entity. If you've never set the position before, will be parented to the center of the prop. Returns 1 if successfully parented or 0 if prop wasn't valid. Does not update the object.

void webaudio:setParent()
Unparents the stream from the currently parented entity. Does not update the object.

void webaudio:parentTo(entity e)
Alias of webaudio:setParent(e) Parents the stream position to e, local to the entity. If you've never set the position before, will be parented to the center of the prop. Does not update the object.

void webaudio:unparent()
Alias of webaudio:setParent(), Unparents the stream from the currently parented entity. Does not update the object.

void webaudio:setRadius(number radius)
Sets the radius in which to the stream will be heard in. Default is 200 and (default) max is 1500. Does not update the object.

void webaudio:setLooping(number looping)
Sets the stream to loop if n ~= 0, else stops looping.

void webaudio:set3DEnabled(number enabled) By default WebAudio streams are 3D, so if enabled is 0 it will be set to "2D", so the sound will be on the player's position if they are within the radius of the stream.

Special

number webaudio:pause()
Pauses the stream where it is currently playing, Returns 1 or 0 if could successfully do so, because of quota. Automatically calls updates self internally.

number webaudio:play()
Starts the stream or continues where it left off after pausing, Returns 1 or 0 if could successfully do so from quota. Automatically updates self internally.

void webaudio:destroy()
Destroys the WebAudio object, rendering it useless. It will silently fail when trying to use it from here on! This gives you another slot to make a WebAudio object

number webaudio:update()
Sends all of the information of the object given by functions like setPos and setTime to the client. You need to call this after running functions without running :play() or :pause() on them since those sync with the client. Returns 1 if could update, 0 if hit transmission quota

Getters

number webaudio:isValid()
Returns 1 or 0 for whether the stream is valid and not destroyed.

number webaudio:isParented()
Returns 1 or 0 for whether the stream is parented

vector webaudio:getPos()
Returns the position of the stream set by setPos. Doesn't work with parented streams since they do that math on the client.

vector webaudio:getVolume()
Returns the volume of the stream set by setVolume

number webaudio:getRadius()
Returns the radius of the stream set by setRadius

number webaudio:getTime()
Returns the current playback time of the stream in seconds.

number webaudio:getState()
Returns the state of the stream, 0 = STOPPED, 1 = PLAYING, 2 = PAUSED, Use the _CHANNEL* constants to get these values easily. (_CHANNEL_STOPPED is 0 for example)

number webaudio:getLength()
Returns the playback duration / length of the stream. Returns -1 if we haven't received the length yet.

string webaudio:getFileName()
Returns the file name of the webaudio stream. Usually but not always returns the URL of the stream, and will return "" if we haven't received the filename yet.

number webaudio:getLooping()
Returns if the stream is looping, set by setLooping

number webaudio:get3DEnabled() Returns if the webaudio is in 3D mode. This is true by default.

array webaudio:getFFT()
Returns an array of 64 FFT values from 0-255.

Ignore System

This is a system similar to how you'd use holoVisible to hide holograms from others.

array webaudio:setIgnored(entity ply, number ignored)
If ignored is not 0, blocks the given user from hearing the stream. Else, unblocks the user.

array webaudio:setIgnored(array plys, number ignored)
If ignored is not 0, sets the stream to ignore certain players. Else, unblocks them all.

number webaudio:getIgnored(entity ply)
Returns if the user is blocked from hearing the stream. Note this also counts if they purged the webaudio stream themself, but doesn't count if they have webaudio disabled. Set by setIgnored

webaudio's People

Contributors

bonyoze avatar kapppa avatar plally avatar styledstrike avatar vurv78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

webaudio's Issues

Use a burst limit for E2 streams

Since #33 isn't going to happen anytime soon, just replace the constant every x ms error with a burst limit so people can actually allocate their streams. Would be almost as satisfying as having no limit (which fixing #33 would do)

Works for some, but not for all.

I'm a part of the Garry's Mod server "Freebuild and Kill," and we've been having an issue as of lately that might be related to WebAudio.
One of our members made this "YouTube Player" that uses WebAudio functions, and they made it public for everyone on the server to use. How it would work is: you place the chip down, type a prefix followed by the URL or video name, and the name of said video would show in chat and in console.
For the past couple weeks, we've been having an issue with these players. People could queue a song, and it'll show in console and in chat, but not everyone hears it. Some people do, some people don't. When I try and queue a song with my own player, again, it shows in chat and in console, but I can't hear it, and neither can others. But we all the same exact player. Instead, it gives this error:
[WA]: Error when creating WebAudio receiver with id 4, Error [BASS_ERROR_TIMEOUT]
Our custom Youtube Core addon doesn't seem to be issue, and all we can think of is that its WebAudio. I have no clue if this is happening around other servers who use WebAudio or what, and I'm not super educated in Expression 2, but just thought I'd get something out there.

Thanks for reading this,

thezcar

Ability to toggle webaudio console printing to prevent console spam

Is your feature request related to a problem? Please describe.
Webaudio prints to console when players create a webaudio object. This is a handy feature for determining who is playing what sounds. Unfortunately, given enough players with enough E2s, other console output (like text chat) will quickly become unreadable as this information is printed.

Describe the solution you'd like
It would be useful to create a ClientConVar or concommand to control whether this information is printed to console, and should default to disabled.

The information being printed to console feels similar to how wire_holograms_display_owners (the concommand) is useful for seeing where and whose holograms are around, but is disabled by default.

From an administrative position, I entirely agree with logging this sort of information so that malicious users can be identified. But for the regular user, this is just going to spam console with information they don't care about. Being able to toggle printing on or off at least gives them the ability to toggle it on whenever they need it, and off otherwise.

Non-E2 support via integration with Sound Emitter, SPU.

Is your feature request related to a problem? Please describe.
Some servers don't let new users use E2. This is reasonable. On the server I play on, cool people who the current users like get the User role with E2 perms. I am not yet Cool.

Describe the solution you'd like
I've always really liked chip/gate solutions a bit more than E2, E2 is great, but it's a bit overkill for some things, and I like wiring things together. I also really like the ZCPU/ZGPU/ZSPU chips and have been trying to learn more about them. I'd like to see a "WebAudio" tab added to the Sound Picker for the Sound Emitter, and similar for the SPU (not sure how the Z SPU works yet, have not got a chance to try anything with it) so that I can add URLs. There should be some sort of validation, coloring the input green when a valid URL is input, yellow when an invalid input is there, and red when a non-whitelisted but otherwise valid URL is there. There should be text boxes explaining this also so new users don't get confused.

Describe alternatives you've considered
I can stick to sounds that are part of Garry's Mod itself, and have access to those via Sound Emitter or SPU. Or I can write E2 glue code, maybe? But it'd be much easier to be able to do it without those. Could also have a WebAudio gate as an alternative to adding a tab to the existing Sound Emitter and SPU. That would probably be easier to code.

Additional context
Apparently the SPU is good at sampled audio. If I could load a file from a URL with a bunch of samples, I could then play those samples by seeking through the audio file! It'd be nice especially if this integration was good at playing specific sections from a loaded file, without playing past a certain section or skipping, although you may have to change from thinking of the audio URL as a stream to thinking of it as a discrete file. So for a live stream you'd probably have to record and cut parts of it to put in memory. It'd be nice if this kind of functionality showed up on the E2 side too of course, so this would probably help E2 users too.

Add getFFT

Spamming net.WriteTable is easy but we're not making a shit addon here are we..

webaudio:set3DEnabled does not actually change the "3d" flag in sound.PlayURL

Describe the bug
Playing an audio file that doesn't support 3D will still result in BASS_ERROR_NO3D despite disabling it webaudio:set3DEnabled(0). This is due to the bug where BASS cannot play AAC codec streams in 3D https://github.com/Facepunch/garrysmod-issues/issues/2296. This is a shame because Youtube uses AAC codec streams and thus isn't directly playable with WebAudio. Streamcore fixes this and it isn't at all an issue (read end of expected behavior).

To Reproduce
Paste down the following code in Expression 2
(The audio was fetched directly from Youtube, but I've downloaded it and put it on Dropbox since Youtube expires the raw audio link after a while)

if (first()) {
    local Url = "https://dl.dropboxusercontent.com/s/olo98rrd1c3w5t4/videoplayback.weba"
    local Audio = webAudio(Url)
    Audio:set3DEnabled(0)
    Audio:setParent(entity())
    Audio:play()
}

Then open console and you should see the following error:
[WA]: Error when creating WebAudio receiver with id n, Error [BASS_ERROR_NO3D]

Expected behavior
WebAudio should remove the "3d" flag when calling sound.PlayURL if 3D is not enabled. Currently, WebAudio just sets the sound's position on top of the player to mimic 2D which is weird considering removing the "3d" flag would already accomplish the effect. The volume of the 2D sound would just have to be set to 0 when the client leaves the listening radius. Streamcore does something similar by lowering the volume the farther the client is from the sound.

Desktop (please complete the following information):

  • OS: Windows
  • Gmod Branch: x86-64

setRate -> setPitch

Ugh.. this function is so stupid. It literally sets the pitch. And the whole time I thought it sped up the stream. There goes the use of lot of the functionality for the stopwatch. Will have to remove and rename it or just change some internal stuff to not set the speed of the timer. yeaaaahhh......... woo...

Play links that are not on the whitelist for the E2 owner only

Is your feature request related to a problem? Please describe.
Currently cannot play links that you yourself trust due to the URL whitelist. Don't want to move all audio away from my website, and cannot in certain instances (audio generators)

Describe the solution you'd like
Probably just playing the link like normally and, similar to printDriver(), giving a notification on the first time doing so that only you can hear audio not on the whitelist

Describe alternatives you've considered

  1. On a WebAudio object, have some function to enable this feature
  2. Some setting similar to how you would enable concmd

Update steam README

Super out of date, my bad.
Also it's too big right now so it can't fit docs. Gonna have to get rid of the fancy table I guess.

Unwhitelisted URL should not stop E2 execution, should fail silently

If an URL tries to play that doesn't match the whitelist, it causes the entire execution of the E2 chip to be stopped. This shouldn't happen; it should fail silently, perhaps printing an error in console, not playing the URL and continuing the execution. Having the entire E2 stop is bad for various situtations, one of them being as follows:

  • A player creates an E2 that allows people to queue songs (i.e. a player executes a chat command such as +play URL)
  • A player requests an URL that does not comply with the whitelist
  • When that object is played, the entire execution of the E2 stops, and must be restarted.
    If players had queued songs after this, then they would have to be re-queued, which is both annoying and unnecessary.

[[E2] WebAudio] lua/entities/gmod_wire_expression2/core/custom/webaudio.lua:22: attempt to call field 'RegisterPlayerTable' (a nil value)

This issue happens when I try to enable the extension.. It happens right after VRCore trys to load. I'll disable VRCore and get back to this.

Edit: Disabling VRCore did not change anything at all.

VRCore loading

[[E2] WebAudio] lua/entities/gmod_wire_expression2/core/custom/webaudio.lua:22: attempt to call field 'RegisterPlayerTable' (a nil value)

  1. unknown - lua/entities/gmod_wire_expression2/core/custom/webaudio.lua:22
  2. unknown - [C]:-1
    3. pcall - [C]:-1
    4. e2_include_finalize - addons/wire-master/lua/entities/gmod_wire_expression2/core/extloader.lua:101
    5. unknown - addons/wire-master/lua/entities/gmod_wire_expression2/core/extloader.lua:172
    6. include - [C]:-1
    7. wire_expression2_reload - addons/wire-master/lua/entities/gmod_wire_expression2/core/extloader.lua:37
    8. unknown - addons/wire-master/lua/entities/gmod_wire_expression2/core/e2lib.lua:572
    9. unknown - lua/includes/modules/concommand.lua:54

Getter functions

Add functions to get information about a stream / IGmodAudioChannel object. For now only gonna support stuff like GetTagsHTTP which are constant throughout the stream, but I'm also thinking of ways to implement FFT and GetState

Stuff to Add:

  • getAverageBitRate
  • getBitsPerSample
  • getSamplingRate
  • getLength
  • getTags functions (There's a ton)
  • getTime (Would be estimated from the server + playback rate, setTime)
  • getFileName

Not guaranteed to add:

  • getFFT (Could use a binary module to get the fft info of the stream, or have a function to enable periodic sending of fft data.)
  • getState (Could just make the client check if state changed, if so, send to server. Would be slightly delayed but it'd work.)
    Also includes stuff like getPos where you're the one setting the position so why aren't you just storing it yourself??

Serverside BASS Function Support

Probably won't be implemented in gmod it because facepunch doesn't care and only left robotboy to work on it. Also it's been 6 years since the linked issue. :D

I just found this and read that wyozi actually implemented an mp3 duration parser so if that's worth it we might even replace the networking with that, so that's really cool

Facepunch/garrysmod-requests#439

https://github.com/wyozi/gmod-medialib/blob/master/ext/mp3duration.lua

Basically replace the networking that will be (or is) needed to get the length of a bass stream as well as the FFT data

This is what I was talking about with a serverside binary module to get FFT or whatever.

Port IsParented to E2

Forgot to do it, making an issue here so people can contribute ๐Ÿ‘
See how isDestroyed is implemented to E2

Block streamed audio

Is your feature request related to a problem? Please describe.
You can't play block-streamed sounds

Describe the solution you'd like
Maybe w/

local Stream = webAudio("<url>", _WA_MODE_BLOCK)

and calls to setTime will error afterward.

Additional context
Unfortunately this would break functions like setTime. I was avoiding doing this considering the confusion it'd cause users if these functions didn't work because they wanted block_streamed audio.

Add wa_list concommand

Would list all of the currently playing streams, their URLs and owners (Time since created would be cool too).

As for lua created streams, would need an extra param as to hide the stream from wa_list.
Or maybe we could just hide streams without owners from the concommand

Clientside error lua/webaudio/receiver.lua:307: Tried to use a NULL entity

Describe the bug
I have no idea how to replicate this as this was happening on a server i was playing on and i couldn't directly see who caused it.
I think the server uses the workshop version.

[ERROR] lua/webaudio/receiver.lua:307: Tried to use a NULL entity!
  1. WorldToLocal - [C]:-1
   2. updateObject - lua/webaudio/receiver.lua:307
    3. func - lua/webaudio/receiver.lua:357
     4. unknown - lua/includes/extensions/net.lua:33

Desktop (please complete the following information):

  • Windows 64x

Prevent destruction net abuse

We should not allow destruction of streams on the same tick as creation or at least make the creation net message wait a bit. I dunno how to really go about this but it's important since it allows for console net error spam.

Receiver parenting error

[[E2] WebAudio] lua/webaudio/receiver.lua:262: Tried to use a NULL entity!
  1. WorldToLocal - [C]:-1
   2. updateObject - lua/webaudio/receiver.lua:262
    3. func - lua/webaudio/receiver.lua:311
     4. unknown - lua/includes/extensions/net.lua:32

Could easily just throw an IsValid there but need to look into why this happens. I can't reproduce it right now

Add set3D

IGModAudioChannel includes various other functions that could be useful when making E2s, such as:
IGModAudioChannel:GetTime()
IGModAudioChannel:Set3DEnabled()
Getting the time would be useful for making player bar indicators which move relative to the sound's progress, and the option to enable/disable 3D sound would be useful for music players where 3D sound is disorientating or other instances where it is unwanted.

[E2 addon] Suggestion - bass error flags and webaudio_maxfilesize sv convar

The current addon seems to lack any bass error flags when all the other webaudio flags pass.
Been trying to test it for about 2 to 3 hours now and none of the files properly open and always return BASS_ERROR_FILEOPEN.
Other addons off-e2 that utilize webaudio aswell have no issues whatsoever, so i am asking for additional flags , namely:

wa_max_filesize
client replicated server_can_execute

to have a maximum filesize the server can set , and for the functions internally for e2:
Number=webAudioErrorType(webaudio)
which would fetch BASS_ErrorGetCode and return the number that it has gotten
(see this link for info)
and
Number=webAudioDidError(webaudio)
which returns 1 incase any of the errors were raised and 0 if not.

No Function with Newest Version anymore

Since the Server Updated to the Newest Workshop Version (v0.6.2) a Couple Days Ago the Addon has no Function anymore. This is the Error Message that Shows in E2

Image1

The E2Helper Search is also empty
Image2
Image3

Make a new showcase video

Anyone can do this, but I will probably get to it at some point.
I want a better quality video to upload to the workshop / youtube that will showcase the new features we've added like time elapsed, etc. If we did this after adding getFFT that'd be great to showcase it as well

// Show a music player or something

Unable to read webaudio from tables and arrays

Describe the bug
Unable to read webaudio from tables and arrays. Attempting to read from a table results in

To Reproduce
Steps to reproduce the behavior:

  1. Join local server
  2. Run the following in an E2

`@name webaudio test
@persist Audio:table

if(first()){
local Stream = webAudio("https://cdn.discordapp.com/attachments/270015260264497154/984533408489295872/sgc_panic_alarm.mp3")
Audio:pushWebaudio(Stream)
Stream:play()
timer("test",550)
}
if(clk("test")){
print("Table Size: "+Audio:count())
print("WA Destroyed?: " + Audio[1,webaudio]:destroy())
}
`
4. See error (WA Destroyed line will print a 0)
5. Replace 'table' in the persistent variables with 'array' and upload to E2
6. See error ("lua/entities/gmod_wire_expression2/core/custom/webaudio.lua:383: attempt to index local 'this' (a nil value)")

Expected behavior
the "Table Size" line should print a 1 to indicate that the stream has been stored in the table, and "WA Destroyed?" line should print also print a 1 to indicate that the WA has been destroyeed.

Desktop (please complete the following information):

  • OS: Windows 10
  • Gmod Branch: x86-64 - Chromium + 64-bit binaries

Add wa_purge

Just loop through all clientside wa receivers in the Audios table and run IGmodAudioChannel:Stop() on them.
Also need to check the Enabled convar in the wa_modify net message so people can't modify audios if you set wa_enable to 0 after they made the object, which would cause errors with these stopped bass objects.

Starfall api

would be pretty easy but I don't have the effort to rn and there's way less of a point.

WebAudio:getFFT() errors - "table index is nil"

Upon testing the WebAudio:getFFT() function, it simply errors out with the following:

sv: Expression 2 (ChatURL Radio - Version A3a Alpha | 27.04.21): entities/gmod_wire_expression2/core/array.lua:100: table index is nil

The code I am using is FFTArray = WebAudio:getFFT(), which causes the E2 to halt and error with the above.
Not sure if this is an error within the addon or Wiremod itself, though.

Add the ability to parent to entities

You'd just constantly set the position of the bass station to the parented entity & Make sure setPos can not be run to avoid unnecessary net messages. Should be easy to do but not a necessary addition.

Add youtubedl.mattjeanes.com to the default whitelist

One of the main reasons why people use Streamcore is so that they can play youtube videos with some sort of ytdl api.

The only current candidate I have to potentially whitelist is https://github.com/MattJeanes/YouTubeDL, because it's open source and owned by someone who is at least decently known in the gmod community.

I think this is a pretty low risk thing to add since it's somewhat easy to prove as open source and you can always just take it off your custom client whitelist. Leaving this open in case for any objections or if someone has a more reputable api.

(Also if you want to ask about gaerrison's api or others, they aren't owned by particularly reputable people nor are they open source, so not happening.) (Also I don't know if you could have a purely github hosted ytdl repo, if so please let me know because that'd kind of void the need for this.)

Make stream creation asynchronous / Not send a net message immediately

When the WebAudio constructor is called, it should only build the serverside object and only sync to the clients / be created clientside when trying to transmit.

This would allow for:

  1. Creating a ton of streams at once and not needing a cooldown to creating the objects
  2. Potentially allowing for a neater way to solve #11

I don't think there's any problems with the idea but if I think of any I'll just close this

Volume and Pause not Working

Describe the bug
The Pause and Volume Function doesnt work

To Reproduce
Steps to reproduce the behavior:
I used the Following E2 Code:

Audio:play()
Audio:setVolume(300)
Audio:update()
Audio:pause()

Expected behavior
I would think that with this Code the Stream Starts, the Volume gets increased to 300% and it Stops the Stream Again.
But in direct Comparision to a Stream with 100% Volume it is not any Louder and the pause() is ignored also. I would expect that the Stream Stops but it just keeps playing

Desktop (please complete the following information):

  • OS: Windows
  • Gmod Branch: x86-64

``wa_display_owners``

Is your feature request related to a problem? Please describe.
Would be useful to track mingebags

Describe the solution you'd like
Adding a convar that works almost exactly like wire's wire_holograms_display_owners

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Would likely be accompanied by a version of wa_purge for a single stream. Or an option to block a certain player's streams.

Prevent id overflow

As of now ids just increment. This is terrible because people can easily spam streams and get the id past the current net limit and break webaudio for everyone. Could easily just wrap around but you never know if one is still active..

Newest release errors -attempt to index local 'Common' (a nil value)

There was an error loading the custom/webaudio.lua extension. Please report this to its developer.
entities/gmod_wire_expression2/core/custom/webaudio.lua:9: attempt to index local 'Common' (a nil value)

Looks like WebAudio.Common isn't initialised with a value on first run for whatever reason

Edit: Another error cropped up whilst testing:

[webaudio-main] addons/webaudio-main/lua/autorun/webaudio.lua:66: attempt to call method 'disassemble' (a nil value)
  1. unknown - addons/webaudio-main/lua/autorun/webaudio.lua:66

Seems like the functions are being called for in the code before they are defined

Send currently playing streams to players when they join / Sync streams

If a stream is currently playing while someone joins, they should join and be able to hear it at the currently playing point. (Ok maybe not at the currently playing point that'd be really hard and require the server to predict where it's at in the song which might work?)

The creator of streamcore didn't wanna put effort into this and since we're the replacement naturally we have to do it....
Maybe make a new net message wa_sync that sends a ton of wa_create data.

What is the Whitelist Format?

Hi,

I'm trying to add broadcastify to the whitelist on my server, but I can't seem to figure out the format for the webaudio_whitelist.txt.
Is it the same is what's in the LUA files?

What exactly does the pattern format do?
pattern %w+%.sndcdn%.com
As opposed to the simple?
simple translate.google.com

I added this to the webaudio.lua file to no avail:
-- Broadcastify
simple [[https://www.broadcastify.com]],
and
simple https://www.broadcastify.com
to webaudio_whitelist.txt, also no success.

The links I desire to use look like this:
https://www.broadcastify.com/scripts/playlists/1/20906/-6461706680.m3u

I receive this message when the E2 is turned on:
sv: Expression 2 (Motorola Spectra - Pennsylvania Rail Radio Channels): Runtime error 'This URL is not whitelisted! The server has a custom whitelist.' at line 8, char 11

Should I whitelist the exact URLs?

Any help would be appreciated.

Add webaudio:setLooping(n)

Sets whether the stream will loop the audio played.
Just add a field to the Modify enum and add a receiver and writer for net and that's pretty much it.

Edit: Would have to also change stopwatch stuff so I don't recommend taking this on

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.