Skip to content
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

User names in voice events become null when muting or moving channel #88

Closed
mikesmiffy128 opened this issue Feb 16, 2016 · 10 comments
Closed

Comments

@mikesmiffy128
Copy link

Hi! First of all, thanks for making this library; it's working great so far!

I've done a bit of looking through the API and there doesn't seem to be a way of getting a list of everyone currently transmitting audio (my goal is to have a little web-based widget that will show all the people currently talking). The way I've thought of going about it is to get the audio streams of each user in a channel, then check if the volume is above a certain level. The problem with this is I'd then have to keep track of everyone joining and leaving, and also open a lot of streams at the same time.

I'm just wondering if there's an easier way I've overlooked, or if something could be implemented. Or is this just a Mumble limitation?

@Rantanen
Copy link
Owner

Glad to hear!

Just checked - seems this part is badly documented and probably needs some enhancements.

You have two options. Either listen to 'voice-start' and 'voice-end' events or alternatively use the 'voice-frame' event. Looking at the documentation, these don't seem to be documented there, but they do exist and can be seen in the code.

  • voice-start and voice-end are sent when a user starts and stops talking. The parameter contains the user session ID.
  • voice-frame contains all the voice packets that are about to be processed. These packets contain user info that further contains the user.session.

The first one will give you quick event based access that should make "display icon"/"hide icon" actions easy to implement, but it won't let you query the connection for a snapshot of "Who is talking at the moment?".

You can also take a look at the following project, which should implement something similar:
https://github.com/Rantanen/mumble-debugger

Specifically it seems to be using a hybrid approach where voice-frames are used to flag the user as talking and voice-end events are used to clear that flag. This was probably to make sure that users are shown as talking even if a certain web client joins the session halfway into a conversation and misses on the voice-start event.

@mikesmiffy128
Copy link
Author

Thanks, that worked perfectly! 👍

@mikesmiffy128
Copy link
Author

Hmm... it seems like there's either a bug or I'm doing something wrong. Whenever I do some kind of action (mute / unmute, move channel, etc.), the name value in each event suddenly becomes null. If either I rejoin the server or I reconnect the bot it seems to fix itself. Any idea what might cause that?

@mikesmiffy128 mikesmiffy128 reopened this Feb 16, 2016
@Rantanen
Copy link
Owner

Which event are you using?

@mikesmiffy128
Copy link
Author

Currently voice-start to show the name in the list and voice-end to remove it. There are another couple of layers of event passing as well but I'm guessing they're not the problem since I'm just directly copying fields from one object to another.

@mikesmiffy128
Copy link
Author

So, I kind of forgot all about this for a while, but I just tried switching to the voice-frame method and apparently the null username issue is still persisting (although it's better anyway so it wasn't waste of time). It would be great to figure out any kind of workaround for this. I've pretty much no idea what's causing this to happen.

@mikesmiffy128 mikesmiffy128 changed the title Is there a way to figure out who is currently talking? User names in voice events become null when muting or moving channel Apr 10, 2016
@Rantanen
Copy link
Owner

Dammit. :)

I think there's been multiple people reporting this now, but I've yet to be able to replicate it myself. I'd love a piece of code and instructions to reproduce this issue.

The annoying bit is that I'm guessing the actual bug is something stupid simple.

@mikesmiffy128
Copy link
Author

So, I've been doing other things for the last couple of days; I have no attention span... but anyway...

I've actually been trying to make a NodeCG bundle. I've not really done much of it yet so the whole thing is a bit messy and probably half-broken, but the bit that's giving me trouble is something to this effect:

mumble.on("voice-frame", function(frames) {
    for (var f in frames) {
        if (frames[f].user) {
            // When stuff starts to break, this will start dumping stuff to the console.
            // Interestingly, most of the data is intact, just none of the ID/name related stuff.
            if (frames[f].user.name === null) {
                console.log(frames[f].user)
            }

            // This is the actual code that I'd use assuming I can help solve this issue :)
            if (frames[f].user.talking) {
                nodecg.sendMessage("user-talking", {name: frames[f].user.name, state: true})
            }
        }
    }
})

Hopefully this helps to some extent! 🙏

@Rantanen
Copy link
Owner

Ended up testing status messages, ie. self mute/deaf/etc.

Those reset the names and such. This issue is now fixed - hopefully I didn't introduce other issues in its place.

@mikesmiffy128
Copy link
Author

Yay! Thank you. 👍
On 13 Apr 2016 21:25, "Mikko Rantanen" notifications@github.com wrote:

Ended up testing status messages, ie. self mute/deaf/etc.

Those reset the names and such. This issue is now fixed - hopefully I
didn't introduce other issues in its place.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#88 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants