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

Don't subscribe to audio/video if occupant is a listener #70

Open
wants to merge 4 commits into
base: 3.0.x
Choose a base branch
from
Open
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
16 changes: 11 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,19 @@ class JanusAdapter {

this.leftOccupants.delete(occupantId);

var subscriber = await this.createSubscriber(occupantId);
var subscriber;
if (occupantId.endsWith("-l")) {
subscriber = {};
this.occupants[occupantId] = subscriber;
} else {
subscriber = await this.createSubscriber(occupantId);

if (!subscriber) return;
if (!subscriber) return;

this.occupants[occupantId] = subscriber;
this.occupants[occupantId] = subscriber;

this.setMediaStream(occupantId, subscriber.mediaStream);
this.setMediaStream(occupantId, subscriber.mediaStream);
}

// Call the Networked AFrame callbacks for the new occupant.
this.onOccupantConnected(occupantId);
Expand All @@ -363,7 +369,7 @@ class JanusAdapter {

if (this.occupants[occupantId]) {
// Close the subscriber peer connection. Which also detaches the plugin handle.
this.occupants[occupantId].conn.close();
this.occupants[occupantId].conn?.close();
delete this.occupants[occupantId];
}

Expand Down