auto_join_3.3
parent
695d366e59
commit
d6d962e379
|
|
@ -12,6 +12,12 @@ import Peer from '../Containers/Peer';
|
|||
import SpeakerPeer from '../Containers/SpeakerPeer';
|
||||
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 = () =>
|
||||
({
|
||||
root :
|
||||
|
|
@ -20,24 +26,22 @@ const styles = () =>
|
|||
width : '100%',
|
||||
display : 'grid',
|
||||
gridTemplateColumns : '1fr',
|
||||
gridTemplateRows : '1.6fr minmax(0, 0.4fr)'
|
||||
gridTemplateRows : '1fr 0.25fr'
|
||||
},
|
||||
speaker :
|
||||
{
|
||||
gridArea : '1 / 1 / 2 / 2',
|
||||
gridArea : '1 / 1 / 1 / 1',
|
||||
display : 'flex',
|
||||
justifyContent : 'center',
|
||||
alignItems : 'center',
|
||||
paddingTop : 40
|
||||
alignItems : 'center'
|
||||
},
|
||||
filmStrip :
|
||||
{
|
||||
gridArea : '2 / 1 / 3 / 2'
|
||||
gridArea : '2 / 1 / 2 / 1'
|
||||
},
|
||||
filmItem :
|
||||
{
|
||||
display : 'flex',
|
||||
marginLeft : '6px',
|
||||
border : 'var(--peer-border)',
|
||||
'&.selected' :
|
||||
{
|
||||
|
|
@ -47,6 +51,16 @@ const styles = () =>
|
|||
{
|
||||
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.rootContainer = React.createRef();
|
||||
|
||||
this.activePeerContainer = React.createRef();
|
||||
|
||||
this.filmStripContainer = React.createRef();
|
||||
|
|
@ -105,24 +121,35 @@ class Filmstrip extends React.PureComponent
|
|||
{
|
||||
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;
|
||||
|
||||
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()))
|
||||
{
|
||||
speakerWidth /= 2;
|
||||
speakerHeight = (speakerWidth / 4) * 3;
|
||||
speakerHeight = speakerWidth / RATIO;
|
||||
}
|
||||
|
||||
if (speakerHeight > (speaker.clientHeight - 60))
|
||||
if (speakerHeight > (availableSpeakerHeight - PADDING_V))
|
||||
{
|
||||
speakerHeight = (speaker.clientHeight - 60);
|
||||
speakerWidth = (speakerHeight / 3) * 4;
|
||||
speakerHeight = (availableSpeakerHeight - PADDING_V);
|
||||
speakerWidth = speakerHeight * RATIO;
|
||||
}
|
||||
|
||||
newState.speakerWidth = speakerWidth;
|
||||
|
|
@ -133,14 +160,18 @@ class Filmstrip extends React.PureComponent
|
|||
|
||||
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;
|
||||
filmStripHeight = (filmStripWidth / 4) * 3;
|
||||
filmStripWidth = (availableWidth - FILMSTRING_PADDING_H) /
|
||||
this.props.boxes;
|
||||
filmStripHeight = filmStripWidth / RATIO;
|
||||
}
|
||||
|
||||
newState.filmStripWidth = filmStripWidth;
|
||||
|
|
@ -199,6 +230,8 @@ class Filmstrip extends React.PureComponent
|
|||
myId,
|
||||
advancedMode,
|
||||
spotlights,
|
||||
toolbarsVisible,
|
||||
permanentTopBar,
|
||||
classes
|
||||
} = this.props;
|
||||
|
||||
|
|
@ -217,7 +250,14 @@ class Filmstrip extends React.PureComponent
|
|||
};
|
||||
|
||||
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}>
|
||||
{ peers[activePeerId] &&
|
||||
<SpeakerPeer
|
||||
|
|
@ -290,6 +330,8 @@ Filmstrip.propTypes = {
|
|||
selectedPeerId : PropTypes.string,
|
||||
spotlights : PropTypes.array.isRequired,
|
||||
boxes : PropTypes.number,
|
||||
toolbarsVisible : PropTypes.bool.isRequired,
|
||||
permanentTopBar : PropTypes.bool,
|
||||
classes : PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
|
|
@ -302,7 +344,9 @@ const mapStateToProps = (state) =>
|
|||
consumers : state.consumers,
|
||||
myId : state.me.id,
|
||||
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 (
|
||||
prev.room.activeSpeakerId === next.room.activeSpeakerId &&
|
||||
prev.room.selectedPeerId === next.room.selectedPeerId &&
|
||||
prev.room.toolbarsVisible === next.room.toolbarsVisible &&
|
||||
prev.settings.permanentTopBar === next.settings.permanentTopBar &&
|
||||
prev.peers === next.peers &&
|
||||
prev.consumers === next.consumers &&
|
||||
prev.room.spotlights === next.room.spotlights &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue