Fixed problems with paused consumers
parent
e9e6e7f60d
commit
b5f50fd580
|
|
@ -31,6 +31,18 @@ export default class LastN extends EventEmitter
|
||||||
this._lastNUpdated();
|
this._lastNUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
peerInLastN(peerName)
|
||||||
|
{
|
||||||
|
if (this._started)
|
||||||
|
{
|
||||||
|
return this._currentLastN.indexOf(peerName) !== -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_handleRoom()
|
_handleRoom()
|
||||||
{
|
{
|
||||||
this._room.on('newpeer', (peer) =>
|
this._room.on('newpeer', (peer) =>
|
||||||
|
|
|
||||||
|
|
@ -353,9 +353,7 @@ export default class RoomClient
|
||||||
{
|
{
|
||||||
for (const consumer of peer.consumers)
|
for (const consumer of peer.consumers)
|
||||||
{
|
{
|
||||||
if (consumer.appData.source !== 'webcam' ||
|
if (consumer.kind !== 'video' || !consumer.supported)
|
||||||
!consumer.supported ||
|
|
||||||
!consumer.locallyPaused)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
await consumer.resume();
|
await consumer.resume();
|
||||||
|
|
@ -365,12 +363,10 @@ export default class RoomClient
|
||||||
{
|
{
|
||||||
for (const consumer of peer.consumers)
|
for (const consumer of peer.consumers)
|
||||||
{
|
{
|
||||||
if (consumer.appData.source !== 'webcam' ||
|
if (consumer.kind !== 'video')
|
||||||
!consumer.supported ||
|
|
||||||
consumer.locallyPaused)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
await consumer.pause();
|
await consumer.pause('not-speaker');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1835,8 +1831,7 @@ export default class RoomClient
|
||||||
// Receive the consumer (if we can).
|
// Receive the consumer (if we can).
|
||||||
if (consumer.supported)
|
if (consumer.supported)
|
||||||
{
|
{
|
||||||
if (consumer.kind === 'video' &&
|
if (consumer.kind === 'video' && !this._lastN.peerInLastN(consumer.peer.name))
|
||||||
Object.keys(this._room.peers).length > this._lastNSpeakers)
|
|
||||||
{ // Start paused
|
{ // Start paused
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'consumer paused by default');
|
'consumer paused by default');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue