foobarlab / UpStage-Video-Hack

UpStage Streaming Hack
http://www.foobarlab.net/
GNU General Public License v2.0
5 stars 1 forks source link

Mute audio when doing live streaming (client.swf) #80

Closed helenvarley closed 11 years ago

helenvarley commented 11 years ago

it's extremely distracting to hear your own audio stream back again, & also will mean feedback loops unless everyone is using headphones. it would be good to have a way to mute your own audio stream in UpStage - maybe this should even be a default? normally you would not want to hear yourself again ...

foobarlab commented 11 years ago

The quick solution could look like this: the player who is holding an avatar (with streaming enabled) will not hear the sound from the streaming.

This will have some side-effects: for live-streaming it is ok, for file streaming (video/audio) it is bad, because the audio is muted. It is not distinguishable right now what kind of streaming it is (live, audio, video).

For the future there are a few possibilities how to handle this:

All those solutions have more or less side-effects and further implications on the software architecture. As quick hack the solution to mute sound for the one holding an avatar seems practical in short-term.

BTW: Feedback loops are a problem of the user not of the software. To get rid of this effect there is no way to solve it in a reasonable way by the software. There is an "echo cancelling" algorithm in Flash included but this only works up to a specific mic level...

helenvarley commented 11 years ago

the first option of the mute button sounds like the best/simplest; since it also could be that the person holding the stream av is not in the same place as the person sending the stream - e.g. during the london discussion, i put the stream av for graz onto the stage, & we wouldn't want that to have been automatically muted then. ideally, they should be able to put their own stream avatar on, but there could be a number of reasons for someone else doing it, in this siutation simply that it was enough work for them just to get the stream going.

foobarlab commented 11 years ago

Ok, if I understood correctly that would mean it will not work in short-term then...

foobarlab commented 11 years ago

The solution will be that there have a few things to be done:

Those things should be available both for players and audience as it could be the case that one who is streaming has to mute it being in the audience or one who is streaming does not hold an avatar.

foobarlab commented 11 years ago

The practical idea on this is to add a HTML div layer on top of the stage which allows selecting the streams and setting the volume with a slider and a mute function.

Communication for JavaScript with Flash (AS2) can be established using the ExternalInterface.

Also the "Page Visibility API" could be handy to determine if the current browser tab/window is visible (see: http://www.w3.org/TR/page-visibility/). Invisible stages could be muted automatically this way. Unfortunately the "Page Visibility API" is not supported in Safari yet (see: http://caniuse.com/pagevisibility).

foobarlab commented 11 years ago

API for using the ExternalInterface in ActionScript2 and JavaScript: http://docs.brajeshwar.com/as2/flash/external/ExternalInterface.html

JQuery Plugin for ExternalInterface: http://www.davecomeau.net/blog/56/jQuery+Plugin%3A+externalInterface

Example for using the "Page Visibility API" in JavaScript:

document.addEventListener('visibilitychange', function(e) {
    console.log('hidden:' + document.hidden,
              'state:' + document.visibilityState)
}, false);
foobarlab commented 11 years ago

For clarification and further discussion the solution in my opinion should be to allow each user (audience+players) to mute any of the live streams. The reason why this can not be automated and should be done manually is that there could be the case that the one sending the stream is not the same holding the stream avatar. Therefore just muting the streams of the avatars in hold does not sufficiently solve the problem. By allowing everyone to mute live stream individually the problem of hearing oneself could be possibly reduced to a minimum.

Also worth to mention is that in general experiencing audio feedback loops is often not a software but a hardware problem as with proper hardware equipment this problem does not occur (e.g. microphones with proper characteristics or a sound mixer with feedback cancellation). AFAIK it definitely can not be solved by software if you get feedback from your voice by microphones you do not control.

helenvarley commented 11 years ago

yes - it should be possible for any logged-in player to mute any stream on stage - because often it could be that the person who is holding the stream is not at their keyboard (i.e. they are doing something in front of the camera) or maybe they are a newbie & can't work out how to mute it. when a player mutes a stream, this should mute that stream for everyone, players and audience. if it was possible for AUDIENCE to mute streams, they should NOT be able to mute it for everyone, only for themselves.

foobarlab commented 11 years ago

Ok, so we probably got a little misunderstanding here. Muting audio for all recipients can already be done using the streaming software (e.g. FMLE or VLC). In my understanding, what is relevant here is always limited to the local computer.

helenvarley commented 11 years ago

yes but that can only be done by the person who is sending the stream; if - for whatever reason - the person sending the stream isn't muting their audio but it needs to be muted (for reasons of feedback, or confusion of too many audio streams, or they have simply forgotten to mute it & are not at the keyboard or whatever) then someone else needs to be able to mute it. i am not 100% certain, but i think that in the tap it is possibe to mute the audio stream of someone else (as player, not as audience).

foobarlab commented 11 years ago

I am not aware what kind of muting is supported in the Tap. It is for sure technically possible to manage audio muting of each stream individually. However, this introduces more technical complexity and could make it more complicated to handle.

foobarlab commented 11 years ago

After some more thinking about the problems I came to the following solution:

  1. Allow every user (players+audience) to locally mute any audio stream. This would prevent the problem hearing oneself during streaming while others still are able to hear the audio stream on their computers.
  2. Allow logged-in users (players) to globally mute single streams for every connected user. This would prevent audio feedback from others microphones as noone will hear the muted audio stream.

This does imply that it is not possible to mute the audio stream on a per connected user basis, meaning you can not mute a single audio stream for each user on their computer individually. For example you can not mute the audio stream for user A while user B does still hear it. If such behavior is wanted we should discuss this further as it has practical and technical implications, at first I hope both requirements above are sufficient.

Sidenote: When talking about muting it is always related to the volume control of the loudspeakers and not about the microphone level...

Is this meeting the requirements so far?

helenvarley commented 11 years ago

sounds good to me! :)

foobarlab commented 11 years ago

Closed in favor of subtickets.