Mostly working mediasoup v3
This commit is contained in:
@@ -51,11 +51,30 @@ const consumers = (state = initialState, action) =>
|
||||
return { ...state, [consumerId]: newConsumer };
|
||||
}
|
||||
|
||||
case 'SET_CONSUMER_EFFECTIVE_PROFILE':
|
||||
case 'SET_CONSUMER_CURRENT_LAYERS':
|
||||
{
|
||||
const { consumerId, profile } = action.payload;
|
||||
const { consumerId, spatialLayer, temporalLayer } = action.payload;
|
||||
const consumer = state[consumerId];
|
||||
const newConsumer = { ...consumer, profile };
|
||||
const newConsumer =
|
||||
{
|
||||
...consumer,
|
||||
currentSpatialLayer : spatialLayer,
|
||||
currentTemporalLayer : temporalLayer
|
||||
};
|
||||
|
||||
return { ...state, [consumerId]: newConsumer };
|
||||
}
|
||||
|
||||
case 'SET_CONSUMER_PREFERRED_LAYERS':
|
||||
{
|
||||
const { consumerId, spatialLayer, temporalLayer } = action.payload;
|
||||
const consumer = state[consumerId];
|
||||
const newConsumer =
|
||||
{
|
||||
...consumer,
|
||||
preferredSpatialLayer : spatialLayer,
|
||||
preferredTemporalLayer : temporalLayer
|
||||
};
|
||||
|
||||
return { ...state, [consumerId]: newConsumer };
|
||||
}
|
||||
@@ -69,6 +88,19 @@ const consumers = (state = initialState, action) =>
|
||||
return { ...state, [consumerId]: newConsumer };
|
||||
}
|
||||
|
||||
case 'SET_CONSUMER_SCORE':
|
||||
{
|
||||
const { consumerId, score } = action.payload;
|
||||
const consumer = state[consumerId];
|
||||
|
||||
if (!consumer)
|
||||
return state;
|
||||
|
||||
const newConsumer = { ...consumer, score };
|
||||
|
||||
return { ...state, [consumerId]: newConsumer };
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
+19
-5
@@ -1,11 +1,12 @@
|
||||
const initialState =
|
||||
{
|
||||
name : null,
|
||||
id : null,
|
||||
device : null,
|
||||
canSendMic : false,
|
||||
canSendWebcam : false,
|
||||
canShareScreen : false,
|
||||
needExtension : false,
|
||||
canShareFiles : false,
|
||||
audioDevices : null,
|
||||
webcamDevices : null,
|
||||
webcamInProgress : false,
|
||||
@@ -24,14 +25,14 @@ const me = (state = initialState, action) =>
|
||||
case 'SET_ME':
|
||||
{
|
||||
const {
|
||||
peerName,
|
||||
peerId,
|
||||
device,
|
||||
loginEnabled
|
||||
} = action.payload;
|
||||
|
||||
return {
|
||||
...state,
|
||||
name : peerName,
|
||||
id : peerId,
|
||||
device,
|
||||
loginEnabled
|
||||
};
|
||||
@@ -45,9 +46,22 @@ const me = (state = initialState, action) =>
|
||||
|
||||
case 'SET_MEDIA_CAPABILITIES':
|
||||
{
|
||||
const { canSendMic, canSendWebcam } = action.payload;
|
||||
const {
|
||||
canSendMic,
|
||||
canSendWebcam,
|
||||
canShareScreen,
|
||||
needExtension,
|
||||
canShareFiles
|
||||
} = action.payload;
|
||||
|
||||
return { ...state, canSendMic, canSendWebcam };
|
||||
return {
|
||||
...state,
|
||||
canSendMic,
|
||||
canSendWebcam,
|
||||
canShareScreen,
|
||||
needExtension,
|
||||
canShareFiles
|
||||
};
|
||||
}
|
||||
|
||||
case 'SET_SCREEN_CAPABILITIES':
|
||||
|
||||
@@ -7,33 +7,33 @@ const peerVolumes = (state = initialState, action) =>
|
||||
case 'SET_ME':
|
||||
{
|
||||
const {
|
||||
peerName
|
||||
peerId
|
||||
} = action.payload;
|
||||
|
||||
return { ...state, [peerName]: 0 };
|
||||
return { ...state, [peerId]: 0 };
|
||||
}
|
||||
case 'ADD_PEER':
|
||||
{
|
||||
const { peer } = action.payload;
|
||||
|
||||
return { ...state, [peer.name]: 0 };
|
||||
return { ...state, [peer.id]: 0 };
|
||||
}
|
||||
|
||||
case 'REMOVE_PEER':
|
||||
{
|
||||
const { peerName } = action.payload;
|
||||
const { peerId } = action.payload;
|
||||
const newState = { ...state };
|
||||
|
||||
delete newState[peerName];
|
||||
delete newState[peerId];
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
case 'SET_PEER_VOLUME':
|
||||
{
|
||||
const { peerName, volume } = action.payload;
|
||||
const { peerId, volume } = action.payload;
|
||||
|
||||
return { ...state, [peerName]: volume };
|
||||
return { ...state, [peerId]: volume };
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
@@ -53,12 +53,12 @@ const peers = (state = {}, action) =>
|
||||
{
|
||||
case 'ADD_PEER':
|
||||
{
|
||||
return { ...state, [action.payload.peer.name]: peer(undefined, action) };
|
||||
return { ...state, [action.payload.peer.id]: peer(undefined, action) };
|
||||
}
|
||||
|
||||
case 'REMOVE_PEER':
|
||||
{
|
||||
return omit(state, [ action.payload.peerName ]);
|
||||
return omit(state, [ action.payload.peerId ]);
|
||||
}
|
||||
|
||||
case 'SET_PEER_DISPLAY_NAME':
|
||||
@@ -69,25 +69,25 @@ const peers = (state = {}, action) =>
|
||||
case 'SET_PEER_PICTURE':
|
||||
case 'ADD_CONSUMER':
|
||||
{
|
||||
const oldPeer = state[action.payload.peerName];
|
||||
const oldPeer = state[action.payload.peerId];
|
||||
|
||||
if (!oldPeer)
|
||||
{
|
||||
throw new Error('no Peer found');
|
||||
}
|
||||
|
||||
return { ...state, [oldPeer.name]: peer(oldPeer, action) };
|
||||
return { ...state, [oldPeer.id]: peer(oldPeer, action) };
|
||||
}
|
||||
|
||||
case 'REMOVE_CONSUMER':
|
||||
{
|
||||
const oldPeer = state[action.payload.peerName];
|
||||
const oldPeer = state[action.payload.peerId];
|
||||
|
||||
// NOTE: This means that the Peer was closed before, so it's ok.
|
||||
if (!oldPeer)
|
||||
return state;
|
||||
|
||||
return { ...state, [oldPeer.name]: peer(oldPeer, action) };
|
||||
return { ...state, [oldPeer.id]: peer(oldPeer, action) };
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
@@ -5,14 +5,14 @@ const initialState =
|
||||
locked : false,
|
||||
lockedOut : false,
|
||||
audioSuspended : false,
|
||||
activeSpeakerName : null,
|
||||
activeSpeakerId : null,
|
||||
torrentSupport : false,
|
||||
showSettings : false,
|
||||
fullScreenConsumer : null, // ConsumerID
|
||||
windowConsumer : null, // ConsumerID
|
||||
toolbarsVisible : true,
|
||||
mode : 'democratic',
|
||||
selectedPeerName : null,
|
||||
selectedPeerId : null,
|
||||
spotlights : [],
|
||||
settingsOpen : false
|
||||
};
|
||||
@@ -35,7 +35,7 @@ const room = (state = initialState, action) =>
|
||||
if (roomState === 'connected')
|
||||
return { ...state, state: roomState };
|
||||
else
|
||||
return { ...state, state: roomState, activeSpeakerName: null };
|
||||
return { ...state, state: roomState, activeSpeakerId: null };
|
||||
}
|
||||
|
||||
case 'SET_ROOM_LOCKED':
|
||||
@@ -69,9 +69,9 @@ const room = (state = initialState, action) =>
|
||||
|
||||
case 'SET_ROOM_ACTIVE_SPEAKER':
|
||||
{
|
||||
const { peerName } = action.payload;
|
||||
const { peerId } = action.payload;
|
||||
|
||||
return { ...state, activeSpeakerName: peerName };
|
||||
return { ...state, activeSpeakerId: peerId };
|
||||
}
|
||||
|
||||
case 'FILE_SHARING_SUPPORTED':
|
||||
@@ -119,13 +119,13 @@ const room = (state = initialState, action) =>
|
||||
|
||||
case 'SET_SELECTED_PEER':
|
||||
{
|
||||
const { selectedPeerName } = action.payload;
|
||||
const { selectedPeerId } = action.payload;
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
||||
selectedPeerName : state.selectedPeerName === selectedPeerName ?
|
||||
null : selectedPeerName
|
||||
selectedPeerId : state.selectedPeerId === selectedPeerId ?
|
||||
null : selectedPeerId
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user