|
@@ -774,6 +774,11 @@ function setupListeners(conference) {
|
774
|
774
|
}
|
775
|
775
|
}
|
776
|
776
|
);
|
|
777
|
+ conference.rtc.addListener(RTCEvents.FAKE_VIDEO_TRACK_CREATED,
|
|
778
|
+ function (track) {
|
|
779
|
+ conference.onTrackAdded(track);
|
|
780
|
+ }
|
|
781
|
+ );
|
777
|
782
|
|
778
|
783
|
conference.room.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS,
|
779
|
784
|
function (value) {
|
|
@@ -2045,7 +2050,7 @@ function JitsiRemoteTrack(RTC, data, sid, ssrc) {
|
2045
|
2050
|
JitsiTrack.call(this, RTC, data.stream,
|
2046
|
2051
|
function () {
|
2047
|
2052
|
this.eventEmitter.emit(JitsiTrackEvents.TRACK_STOPPED);
|
2048
|
|
- }.bind(this), data.type);
|
|
2053
|
+ }.bind(this), data.jitsiTrackType);
|
2049
|
2054
|
this.rtc = RTC;
|
2050
|
2055
|
this.sid = sid;
|
2051
|
2056
|
this.stream = data.stream;
|
|
@@ -2071,7 +2076,10 @@ JitsiRemoteTrack.prototype.setMute = function (value) {
|
2071
|
2076
|
if(this.muted === value)
|
2072
|
2077
|
return;
|
2073
|
2078
|
|
2074
|
|
- this.stream.muted = value;
|
|
2079
|
+ // we can have a fake video stream
|
|
2080
|
+ if(this.stream)
|
|
2081
|
+ this.stream.muted = value;
|
|
2082
|
+
|
2075
|
2083
|
this.muted = value;
|
2076
|
2084
|
this.eventEmitter.emit(JitsiTrackEvents.TRACK_MUTE_CHANGED);
|
2077
|
2085
|
};
|
|
@@ -2166,11 +2174,11 @@ function addMediaStreamInactiveHandler(mediaStream, handler) {
|
2166
|
2174
|
* @param stream the stream
|
2167
|
2175
|
* @param streamInactiveHandler the function that will handle
|
2168
|
2176
|
* onended/oninactive events of the stream.
|
2169
|
|
- * @param type optionally a type can be specified.
|
|
2177
|
+ * @param jitsiTrackType optionally a type can be specified.
|
2170
|
2178
|
* This is the case where we are creating a dummy track with no stream
|
2171
|
2179
|
* Currently this happens when a remote side is starting with video muted
|
2172
|
2180
|
*/
|
2173
|
|
-function JitsiTrack(rtc, stream, streamInactiveHandler, type)
|
|
2181
|
+function JitsiTrack(rtc, stream, streamInactiveHandler, jitsiTrackType)
|
2174
|
2182
|
{
|
2175
|
2183
|
/**
|
2176
|
2184
|
* Array with the HTML elements that are displaying the streams.
|
|
@@ -2181,7 +2189,7 @@ function JitsiTrack(rtc, stream, streamInactiveHandler, type)
|
2181
|
2189
|
this.stream = stream;
|
2182
|
2190
|
this.eventEmitter = new EventEmitter();
|
2183
|
2191
|
this.audioLevel = -1;
|
2184
|
|
- this.type = type || (this.stream.getVideoTracks().length > 0)?
|
|
2192
|
+ this.type = jitsiTrackType || (this.stream.getVideoTracks().length > 0)?
|
2185
|
2193
|
JitsiTrack.VIDEO : JitsiTrack.AUDIO;
|
2186
|
2194
|
if(this.type == JitsiTrack.AUDIO) {
|
2187
|
2195
|
this._getTracks = function () {
|
|
@@ -2317,7 +2325,10 @@ JitsiTrack.prototype._getId = function () {
|
2317
|
2325
|
* @returns {string} id of the track or null if this is fake track.
|
2318
|
2326
|
*/
|
2319
|
2327
|
JitsiTrack.prototype.getId = function () {
|
2320
|
|
- return RTC.getStreamID(this.stream);
|
|
2328
|
+ if(this.stream)
|
|
2329
|
+ return RTC.getStreamID(this.stream);
|
|
2330
|
+ else
|
|
2331
|
+ return null;
|
2321
|
2332
|
};
|
2322
|
2333
|
|
2323
|
2334
|
/**
|
|
@@ -2416,11 +2427,13 @@ function RTC(room, options) {
|
2416
|
2427
|
// we need to create a dummy track which we will mute, so we can
|
2417
|
2428
|
// notify interested about the muting
|
2418
|
2429
|
if(!self.remoteStreams[from][JitsiTrack.VIDEO]) {
|
2419
|
|
- self.createRemoteStream(
|
|
2430
|
+ var track = self.createRemoteStream(
|
2420
|
2431
|
{peerjid:room.roomjid + "/" + from,
|
2421
|
2432
|
videoType:"camera",
|
2422
|
|
- type:JitsiTrack.VIDEO},
|
|
2433
|
+ jitsiTrackType:JitsiTrack.VIDEO},
|
2423
|
2434
|
null, null);
|
|
2435
|
+ self.eventEmitter
|
|
2436
|
+ .emit(RTCEvents.FAKE_VIDEO_TRACK_CREATED, track);
|
2424
|
2437
|
}
|
2425
|
2438
|
|
2426
|
2439
|
self.remoteStreams[from][JitsiTrack.VIDEO]
|
|
@@ -31323,7 +31336,8 @@ var RTCEvents = {
|
31323
|
31336
|
LASTN_CHANGED: "rtc.lastn_changed",
|
31324
|
31337
|
DOMINANTSPEAKER_CHANGED: "rtc.dominantspeaker_changed",
|
31325
|
31338
|
LASTN_ENDPOINT_CHANGED: "rtc.lastn_endpoint_changed",
|
31326
|
|
- AVAILABLE_DEVICES_CHANGED: "rtc.available_devices_changed"
|
|
31339
|
+ AVAILABLE_DEVICES_CHANGED: "rtc.available_devices_changed",
|
|
31340
|
+ FAKE_VIDEO_TRACK_CREATED: "rtc.fake_video_track_created"
|
31327
|
31341
|
};
|
31328
|
31342
|
|
31329
|
31343
|
module.exports = RTCEvents;
|