@ -1,5 +1,5 @@
import { JitsiConferenceEvents } from '../lib-jitsi-meet' ;
import { setVideoMuted } from '../media' ;
import { setAudioMuted , set VideoMuted } from '../media' ;
import {
dominantSpeakerChanged ,
getLocalParticipant ,
@ -19,7 +19,6 @@ import {
CONFERENCE _WILL _LEAVE ,
LOCK _STATE _CHANGED ,
SET _AUDIO _ONLY ,
_SET _AUDIO _ONLY _VIDEO _MUTED ,
SET _LARGE _VIDEO _HD _STATUS ,
SET _LASTN ,
SET _PASSWORD ,
@ -61,6 +60,19 @@ function _addConferenceListeners(conference, dispatch) {
JitsiConferenceEvents . LOCK _STATE _CHANGED ,
( ... args ) => dispatch ( lockStateChanged ( conference , ... args ) ) ) ;
// Dispatches into features/base/media follow:
// FIXME: This is needed because when Jicofo tells us to start muted
// lib-jitsi-meet does the actual muting. Perhaps this should be refactored
// so applications are hinted to start muted, but lib-jitsi-meet doesn't
// take action.
conference . on (
JitsiConferenceEvents . STARTED _MUTED ,
( ) => {
dispatch ( setAudioMuted ( Boolean ( conference . startAudioMuted ) ) ) ;
dispatch ( setVideoMuted ( Boolean ( conference . startVideoMuted ) ) ) ;
} ) ;
// Dispatches into features/base/tracks follow:
conference . on (
@ -296,58 +308,18 @@ export function lockStateChanged(conference, locked) {
*
* @ param { boolean } audioOnly - True if the conference should be audio only ;
* false , otherwise .
* @ private
* @ returns { {
* type : SET _AUDIO _ONLY ,
* audioOnly : boolean
* } }
* /
function _ setAudioOnly( audioOnly ) {
export function setAudioOnly ( audioOnly ) {
return {
type : SET _AUDIO _ONLY ,
audioOnly
} ;
}
/ * *
* Signals that the app should mute video because it ' s now in audio - only mode ,
* or unmute it because it no longer is . If video was already muted , nothing
* will happen ; otherwise , it will be muted . When audio - only mode is disabled ,
* the previous state will be restored .
*
* @ param { boolean } muted - True if video should be muted ; false , otherwise .
* @ protected
* @ returns { Function }
* /
export function _setAudioOnlyVideoMuted ( muted : boolean ) {
return ( dispatch , getState ) => {
if ( muted ) {
const { video } = getState ( ) [ 'features/base/media' ] ;
if ( video . muted ) {
// Video is already muted, do nothing.
return ;
}
} else {
const { audioOnlyVideoMuted }
= getState ( ) [ 'features/base/conference' ] ;
if ( ! audioOnlyVideoMuted ) {
// We didn't mute video, do nothing.
return ;
}
}
// Remember that local video was muted due to the audio-only mode
// vs user's choice.
dispatch ( {
type : _SET _AUDIO _ONLY _VIDEO _MUTED ,
muted
} ) ;
dispatch ( setVideoMuted ( muted ) ) ;
} ;
}
/ * *
* Action to set whether or not the currently displayed large video is in
* high - definition .
@ -488,6 +460,6 @@ export function toggleAudioOnly() {
return ( dispatch : Dispatch < * > , getState : Function ) => {
const { audioOnly } = getState ( ) [ 'features/base/conference' ] ;
return dispatch ( _ setAudioOnly( ! audioOnly ) ) ;
return dispatch ( setAudioOnly ( ! audioOnly ) ) ;
} ;
}