auto_join_3.3
parent
695d366e59
commit
d6d962e379
|
|
@ -12,6 +12,12 @@ import Peer from '../Containers/Peer';
|
||||||
import SpeakerPeer from '../Containers/SpeakerPeer';
|
import SpeakerPeer from '../Containers/SpeakerPeer';
|
||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from '@material-ui/core/Grid';
|
||||||
|
|
||||||
|
const RATIO = 1.334;
|
||||||
|
const PADDING_V = 40;
|
||||||
|
const PADDING_H = 0;
|
||||||
|
const FILMSTRING_PADDING_V = 10;
|
||||||
|
const FILMSTRING_PADDING_H = 0;
|
||||||
|
|
||||||
const styles = () =>
|
const styles = () =>
|
||||||
({
|
({
|
||||||
root :
|
root :
|
||||||
|
|
@ -20,24 +26,22 @@ const styles = () =>
|
||||||
width : '100%',
|
width : '100%',
|
||||||
display : 'grid',
|
display : 'grid',
|
||||||
gridTemplateColumns : '1fr',
|
gridTemplateColumns : '1fr',
|
||||||
gridTemplateRows : '1.6fr minmax(0, 0.4fr)'
|
gridTemplateRows : '1fr 0.25fr'
|
||||||
},
|
},
|
||||||
speaker :
|
speaker :
|
||||||
{
|
{
|
||||||
gridArea : '1 / 1 / 2 / 2',
|
gridArea : '1 / 1 / 1 / 1',
|
||||||
display : 'flex',
|
display : 'flex',
|
||||||
justifyContent : 'center',
|
justifyContent : 'center',
|
||||||
alignItems : 'center',
|
alignItems : 'center'
|
||||||
paddingTop : 40
|
|
||||||
},
|
},
|
||||||
filmStrip :
|
filmStrip :
|
||||||
{
|
{
|
||||||
gridArea : '2 / 1 / 3 / 2'
|
gridArea : '2 / 1 / 2 / 1'
|
||||||
},
|
},
|
||||||
filmItem :
|
filmItem :
|
||||||
{
|
{
|
||||||
display : 'flex',
|
display : 'flex',
|
||||||
marginLeft : '6px',
|
|
||||||
border : 'var(--peer-border)',
|
border : 'var(--peer-border)',
|
||||||
'&.selected' :
|
'&.selected' :
|
||||||
{
|
{
|
||||||
|
|
@ -47,6 +51,16 @@ const styles = () =>
|
||||||
{
|
{
|
||||||
opacity : '0.6'
|
opacity : '0.6'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
hiddenToolBar :
|
||||||
|
{
|
||||||
|
paddingTop : 0,
|
||||||
|
transition : 'padding .5s'
|
||||||
|
},
|
||||||
|
showingToolBar :
|
||||||
|
{
|
||||||
|
paddingTop : 60,
|
||||||
|
transition : 'padding .5s'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -58,6 +72,8 @@ class Filmstrip extends React.PureComponent
|
||||||
|
|
||||||
this.resizeTimeout = null;
|
this.resizeTimeout = null;
|
||||||
|
|
||||||
|
this.rootContainer = React.createRef();
|
||||||
|
|
||||||
this.activePeerContainer = React.createRef();
|
this.activePeerContainer = React.createRef();
|
||||||
|
|
||||||
this.filmStripContainer = React.createRef();
|
this.filmStripContainer = React.createRef();
|
||||||
|
|
@ -105,24 +121,35 @@ class Filmstrip extends React.PureComponent
|
||||||
{
|
{
|
||||||
const newState = {};
|
const newState = {};
|
||||||
|
|
||||||
|
const root = this.rootContainer.current;
|
||||||
|
|
||||||
|
const availableWidth = root.clientWidth;
|
||||||
|
// Grid is:
|
||||||
|
// 4/5 speaker
|
||||||
|
// 1/5 filmstrip
|
||||||
|
const availableSpeakerHeight = (root.clientHeight * 0.8) -
|
||||||
|
(this.props.toolbarsVisible || this.props.permanentTopBar ? PADDING_V : PADDING_H);
|
||||||
|
|
||||||
|
const availableFilmstripHeight = root.clientHeight * 0.2;
|
||||||
|
|
||||||
const speaker = this.activePeerContainer.current;
|
const speaker = this.activePeerContainer.current;
|
||||||
|
|
||||||
if (speaker)
|
if (speaker)
|
||||||
{
|
{
|
||||||
let speakerWidth = (speaker.clientWidth - 100);
|
let speakerWidth = (availableWidth - PADDING_H);
|
||||||
|
|
||||||
let speakerHeight = (speakerWidth / 4) * 3;
|
let speakerHeight = speakerWidth / RATIO;
|
||||||
|
|
||||||
if (this.isSharingCamera(this.getActivePeerId()))
|
if (this.isSharingCamera(this.getActivePeerId()))
|
||||||
{
|
{
|
||||||
speakerWidth /= 2;
|
speakerWidth /= 2;
|
||||||
speakerHeight = (speakerWidth / 4) * 3;
|
speakerHeight = speakerWidth / RATIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (speakerHeight > (speaker.clientHeight - 60))
|
if (speakerHeight > (availableSpeakerHeight - PADDING_V))
|
||||||
{
|
{
|
||||||
speakerHeight = (speaker.clientHeight - 60);
|
speakerHeight = (availableSpeakerHeight - PADDING_V);
|
||||||
speakerWidth = (speakerHeight / 3) * 4;
|
speakerWidth = speakerHeight * RATIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
newState.speakerWidth = speakerWidth;
|
newState.speakerWidth = speakerWidth;
|
||||||
|
|
@ -133,14 +160,18 @@ class Filmstrip extends React.PureComponent
|
||||||
|
|
||||||
if (filmStrip)
|
if (filmStrip)
|
||||||
{
|
{
|
||||||
let filmStripHeight = filmStrip.clientHeight - 10;
|
let filmStripHeight = availableFilmstripHeight - FILMSTRING_PADDING_V;
|
||||||
|
|
||||||
let filmStripWidth = (filmStripHeight / 3) * 4;
|
let filmStripWidth = filmStripHeight * RATIO;
|
||||||
|
|
||||||
if (filmStripWidth * this.props.boxes > (filmStrip.clientWidth - 50))
|
if (
|
||||||
|
(filmStripWidth * this.props.boxes) >
|
||||||
|
(availableWidth - FILMSTRING_PADDING_H)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
filmStripWidth = (filmStrip.clientWidth - 50) / this.props.boxes;
|
filmStripWidth = (availableWidth - FILMSTRING_PADDING_H) /
|
||||||
filmStripHeight = (filmStripWidth / 4) * 3;
|
this.props.boxes;
|
||||||
|
filmStripHeight = filmStripWidth / RATIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
newState.filmStripWidth = filmStripWidth;
|
newState.filmStripWidth = filmStripWidth;
|
||||||
|
|
@ -199,6 +230,8 @@ class Filmstrip extends React.PureComponent
|
||||||
myId,
|
myId,
|
||||||
advancedMode,
|
advancedMode,
|
||||||
spotlights,
|
spotlights,
|
||||||
|
toolbarsVisible,
|
||||||
|
permanentTopBar,
|
||||||
classes
|
classes
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
|
@ -217,7 +250,14 @@ class Filmstrip extends React.PureComponent
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div
|
||||||
|
className={classnames(
|
||||||
|
classes.root,
|
||||||
|
toolbarsVisible || permanentTopBar ?
|
||||||
|
classes.showingToolBar : classes.hiddenToolBar
|
||||||
|
)}
|
||||||
|
ref={this.rootContainer}
|
||||||
|
>
|
||||||
<div className={classes.speaker} ref={this.activePeerContainer}>
|
<div className={classes.speaker} ref={this.activePeerContainer}>
|
||||||
{ peers[activePeerId] &&
|
{ peers[activePeerId] &&
|
||||||
<SpeakerPeer
|
<SpeakerPeer
|
||||||
|
|
@ -290,6 +330,8 @@ Filmstrip.propTypes = {
|
||||||
selectedPeerId : PropTypes.string,
|
selectedPeerId : PropTypes.string,
|
||||||
spotlights : PropTypes.array.isRequired,
|
spotlights : PropTypes.array.isRequired,
|
||||||
boxes : PropTypes.number,
|
boxes : PropTypes.number,
|
||||||
|
toolbarsVisible : PropTypes.bool.isRequired,
|
||||||
|
permanentTopBar : PropTypes.bool,
|
||||||
classes : PropTypes.object.isRequired
|
classes : PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -302,7 +344,9 @@ const mapStateToProps = (state) =>
|
||||||
consumers : state.consumers,
|
consumers : state.consumers,
|
||||||
myId : state.me.id,
|
myId : state.me.id,
|
||||||
spotlights : state.room.spotlights,
|
spotlights : state.room.spotlights,
|
||||||
boxes : videoBoxesSelector(state)
|
boxes : videoBoxesSelector(state),
|
||||||
|
toolbarsVisible : state.room.toolbarsVisible,
|
||||||
|
permanentTopBar : state.settings.permanentTopBar
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -316,6 +360,8 @@ export default withRoomContext(connect(
|
||||||
return (
|
return (
|
||||||
prev.room.activeSpeakerId === next.room.activeSpeakerId &&
|
prev.room.activeSpeakerId === next.room.activeSpeakerId &&
|
||||||
prev.room.selectedPeerId === next.room.selectedPeerId &&
|
prev.room.selectedPeerId === next.room.selectedPeerId &&
|
||||||
|
prev.room.toolbarsVisible === next.room.toolbarsVisible &&
|
||||||
|
prev.settings.permanentTopBar === next.settings.permanentTopBar &&
|
||||||
prev.peers === next.peers &&
|
prev.peers === next.peers &&
|
||||||
prev.consumers === next.consumers &&
|
prev.consumers === next.consumers &&
|
||||||
prev.room.spotlights === next.room.spotlights &&
|
prev.room.spotlights === next.room.spotlights &&
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue