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

Add forcemute unmute #306

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
333 changes: 299 additions & 34 deletions src/main/java/org/jitsi/jigasi/JvbConference.java

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions src/main/java/org/jitsi/jigasi/SoundNotificationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,26 @@ public class SoundNotificationManager
*/
private static final String LOBBY_JOIN_REVIEW = "sounds/LobbyWait.opus";

/**
* The sound file to use to notify that the participant is allowed to speak.
*/
private static final String FORCE_UNMUTE_ALLOWED = "sounds/ForceUnmuteAllowed.opus";

/**
* The sound file to use to notify that participant is now allowed to speak.
*/
private static final String FORCE_UNMUTE_NOSPEAKERS = "sounds/ForceUnmuteNoSpeakers.opus";

/**
* The sound file to use to notify that the request to unmute is being moderated.
*/
private static final String FORCE_UNMUTE_REQUEST = "sounds/ForceUnmuteRequest.opus";

/**
* The sound file to use to notify that the request to unmute is being moderated and user has to wait.
*/
private static final String FORCE_UNMUTE_REQUEST_REVIEW = "sounds/ForceUnmuteRequestReview.opus";

/**
* Approximate duration of the file to be played, we need it as to know
* when to hangup the call. The actual file is 10 seconds but we give a
Expand Down Expand Up @@ -710,6 +730,26 @@ public void notifyLobbyRoomDestroyed()
playSoundFileIfPossible(LOBBY_MEETING_END);
}

/**
* Used to notify that the user is allowed to unmute.
*/
public void notifyForceUnmuteAllowed() { playSoundFileIfPossible(FORCE_UNMUTE_ALLOWED); }

/**
* Used to notify that the user is not allowed to unmute.
*/
public void notifyForceUnmuteNoSpeakers() { playSoundFileIfPossible(FORCE_UNMUTE_NOSPEAKERS); }

/**
* Used to notify that the request to unmute has been sent to the moderator.
*/
public void notifyForceUnmuteRequest() { playSoundFileIfPossible(FORCE_UNMUTE_REQUEST); }

/**
* Used to notify that the request to unmute has been sent to the moderator and user has to wait.
*/
public void notifyForceUnmuteRequestReview() { playSoundFileIfPossible(FORCE_UNMUTE_REQUEST_REVIEW); }

/**
* Sends sound notification that tells the user
* is alone in the conference.
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/jitsi/jigasi/mute/ForceMute.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.jitsi.jigasi.mute;

import org.jitsi.jigasi.JvbConference;

public abstract class ForceMute
{
protected JvbConference conference;

public abstract boolean requestAudioMute(boolean muted);

public abstract void setAllowedToSpeak(boolean allowedToSpeak);

public abstract boolean enabled();
}
30 changes: 30 additions & 0 deletions src/main/java/org/jitsi/jigasi/mute/ForceMuteDisabled.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.jitsi.jigasi.mute;

import org.jitsi.jigasi.JvbConference;

public class ForceMuteDisabled
extends ForceMute
{

public ForceMuteDisabled(JvbConference jvbConference)
{
this.conference = jvbConference;
}

@Override
public boolean requestAudioMute(boolean mute)
{
return this.conference.sendAudioMuteRequest(mute);
}

@Override
public void setAllowedToSpeak(boolean allowedToSpeak)
{

}

@Override
public boolean enabled() {
return false;
}
}
46 changes: 46 additions & 0 deletions src/main/java/org/jitsi/jigasi/mute/ForceMuteEnabled.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.jitsi.jigasi.mute;

import org.jitsi.jigasi.JvbConference;

public class ForceMuteEnabled
extends ForceMute
{

private boolean allowedToSpeak;

public ForceMuteEnabled(JvbConference jvbConference)
{
this.conference = jvbConference;
this.allowedToSpeak = false;
}

@Override
public boolean requestAudioMute(boolean mute)
{
if (!this.allowedToSpeak)
{
if (mute)
{
return this.conference.sendAudioMuteRequest(mute);
}

return false;
}

// TODO reset allowed to speak flag?
allowedToSpeak = false;

return this.conference.sendAudioMuteRequest(mute);
}

@Override
public void setAllowedToSpeak(boolean allowedToSpeak)
{
this.allowedToSpeak = allowedToSpeak;
}

@Override
public boolean enabled() {
return true;
}
}
Binary file added src/main/resources/sounds/ForceUnmuteAllowed.opus
Binary file not shown.
Binary file not shown.
Binary file added src/main/resources/sounds/ForceUnmuteRequest.opus
Binary file not shown.
Binary file not shown.