|
@@ -148,14 +148,25 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
148
|
148
|
this._noDataFromSourceTimeout = null;
|
149
|
149
|
|
150
|
150
|
this._onDeviceListWillChange = devices => {
|
|
151
|
+ const oldRealDeviceId = this._realDeviceId;
|
|
152
|
+
|
151
|
153
|
this._setRealDeviceIdFromDeviceList(devices);
|
152
|
154
|
|
153
|
|
- // Mark track as ended for those browsers that do not support
|
154
|
|
- // "readyState" property. We do not touch tracks created with
|
155
|
|
- // default device ID "".
|
156
|
|
- if (typeof this.getTrack().readyState === 'undefined'
|
|
155
|
+ if (
|
|
156
|
+ // Mark track as ended for those browsers that do not support
|
|
157
|
+ // "readyState" property. We do not touch tracks created with
|
|
158
|
+ // default device ID "".
|
|
159
|
+ (typeof this.getTrack().readyState === 'undefined'
|
157
|
160
|
&& typeof this._realDeviceId !== 'undefined'
|
158
|
|
- && !devices.find(d => d.deviceId === this._realDeviceId)) {
|
|
161
|
+ && !devices.find(d => d.deviceId === this._realDeviceId))
|
|
162
|
+
|
|
163
|
+ // If there was an associated realDeviceID and after the device change the realDeviceId is undefined
|
|
164
|
+ // then the associated device has been disconnected and the _trackEnded flag needs to be set. In
|
|
165
|
+ // addition on some Chrome versions the readyState property is set after the device change event is
|
|
166
|
+ // triggered which causes issues in jitsi-meet with the selection of a new device because we don't
|
|
167
|
+ // detect that the old one was removed.
|
|
168
|
+ || (typeof oldRealDeviceId !== 'undefined' && typeof this._realDeviceId === 'undefined')
|
|
169
|
+ ) {
|
159
|
170
|
this._trackEnded = true;
|
160
|
171
|
}
|
161
|
172
|
};
|
|
@@ -182,6 +193,12 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
182
|
193
|
* @returns {boolean}
|
183
|
194
|
*/
|
184
|
195
|
isEnded() {
|
|
196
|
+ if (this.isVideoTrack() && this.isMuted()) {
|
|
197
|
+ // If a video track is muted the readyState will be ended, that's why we need to rely only on the
|
|
198
|
+ // _trackEnded flag.
|
|
199
|
+ return this._trackEnded;
|
|
200
|
+ }
|
|
201
|
+
|
185
|
202
|
return this.getTrack().readyState === 'ended' || this._trackEnded;
|
186
|
203
|
}
|
187
|
204
|
|
|
@@ -279,6 +296,8 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
279
|
296
|
|
280
|
297
|
if (device) {
|
281
|
298
|
this._realDeviceId = device.deviceId;
|
|
299
|
+ } else {
|
|
300
|
+ this._realDeviceId = undefined;
|
282
|
301
|
}
|
283
|
302
|
}
|
284
|
303
|
|