Skip to content

Commit

Permalink
Adding debug output onRemoteTrack
Browse files Browse the repository at this point in the history
  • Loading branch information
luvolondon authored Apr 8, 2020
1 parent 494c79a commit e3d3724
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 48 deletions.
63 changes: 17 additions & 46 deletions jitsirtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ class JitsiRTCClient extends WebRTCInterface {

const participant = track.getParticipantId();
const client = game.webrtc.client;
console.warn("Jitsi: track added " + participant );

console.warn("Jitsi: track type " + track.getType() + " added " + participant );
if (client._remoteTracks[participant] == null)
client._remoteTracks[participant] = [];

Expand All @@ -169,27 +170,13 @@ class JitsiRTCClient extends WebRTCInterface {
if (userId != null) {
game.webrtc.onUserStreamChange( userId,client.getRemoteStreamForId(participant));
}
/*
track.addEventListener(
JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
audioLevel => console.log(`Audio Level remote: ${audioLevel}`));
track.addEventListener(
JitsiMeetJS.events.track.TRACK_MUTE_CHANGED,
() => console.log('remote track muted'));
*/

track.addEventListener(
JitsiMeetJS.events.track.LOCAL_TRACK_STOPPED,
() => console.log('Jitsi: remote track stoped'));

this.semaphore_end;

/*
track.addEventListener(
JitsiMeetJS.events.track.TRACK_AUDIO_OUTPUT_CHANGED,
deviceId =>
console.log(
`track audio output device was changed to ${deviceId}`));
*/
}
/**
* Handles incoming lost remote track
Expand All @@ -204,43 +191,27 @@ class JitsiRTCClient extends WebRTCInterface {

const participant = track.getParticipantId();
const client = game.webrtc.client;
console.warn("Jitsi: track removed " + participant );

client._remoteTracks[participant] = client._remoteTracks[participant].filter(function(value, index, arr){ return value.ssrc != track.ssrc;});
console.warn("Jitsi: track type " + track.getType() + " removed " + participant );

const userId = client._idCache[participant];
if (client._remoteTracks[participant] != null) {
client._remoteTracks[participant] = client._remoteTracks[participant].filter(function(value, index, arr){ return value.ssrc != track.ssrc;});

if (userId != null) {
if (client._remoteTracks[participant].length == 0) {
client._remoteTracks[participant] = null;
game.webrtc.onUserStreamChange( userId,null);

} else {
game.webrtc.onUserStreamChange( userId,client.getRemoteStreamForId(participant));

const userId = client._idCache[participant];

if (userId != null) {
if (client._remoteTracks[participant].length == 0) {
client._remoteTracks[participant] = null;
game.webrtc.onUserStreamChange( userId,null);

} else {
game.webrtc.onUserStreamChange( userId,client.getRemoteStreamForId(participant));

}
}
}
/*
track.addEventListener(
JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
audioLevel => console.log(`Audio Level remote: ${audioLevel}`));
track.addEventListener(
JitsiMeetJS.events.track.TRACK_MUTE_CHANGED,
() => console.log('remote track muted'));
*/
track.addEventListener(
JitsiMeetJS.events.track.LOCAL_TRACK_STOPPED,
() => console.log('Jitsi: remote track stoped'));

this.semaphore_end;

/*
track.addEventListener(
JitsiMeetJS.events.track.TRACK_AUDIO_OUTPUT_CHANGED,
deviceId =>
console.log(
`track audio output device was changed to ${deviceId}`));
*/
}
getRemoteStreamForId(id) {
let stream = new JitsiMediaStream();
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"title": "Jitsi WebRTC client",
"description": "Use Jitsi to handle A/V. Connect to jitsi.org or self-hosted server.",
"author": "Luvolondon",
"version": "0.1.4",
"version": "0.1.5",
"styles": [],
"packs": [],
"url": "https://github.com/luvolondon/fvtt-module-jitsiwebrtc",
"manifest": "https://raw.githubusercontent.com/luvolondon/fvtt-module-jitsiwebrtc/master/module.json",
"download": "https://github.com/luvolondon/fvtt-module-jitsiwebrtc/archive/v0.1.4.zip",
"download": "https://github.com/luvolondon/fvtt-module-jitsiwebrtc/archive/v0.1.5.zip",
"minimumCoreVersion": "0.5.3",
"scripts": ["jitsirtc.js","lib-jitsi-meet.min.js"]
}

0 comments on commit e3d3724

Please sign in to comment.