Working fullscreen view
parent
fa94a62d9d
commit
3b03b24cc4
|
|
@ -0,0 +1,91 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import * as appPropTypes from './appPropTypes';
|
||||
import * as stateActions from '../redux/stateActions';
|
||||
import FullView from './FullView';
|
||||
|
||||
const FullScreenView = (props) =>
|
||||
{
|
||||
const {
|
||||
advancedMode,
|
||||
consumer,
|
||||
toggleConsumerFullscreen
|
||||
} = props;
|
||||
|
||||
if (!consumer)
|
||||
return null;
|
||||
|
||||
const consumerVisible = (
|
||||
Boolean(consumer) &&
|
||||
!consumer.locallyPaused &&
|
||||
!consumer.remotelyPaused
|
||||
);
|
||||
|
||||
let consumerProfile;
|
||||
|
||||
if (consumer)
|
||||
consumerProfile = consumer.profile;
|
||||
|
||||
return (
|
||||
<div data-component='FullScreenView'>
|
||||
{consumerVisible && !consumer.supported ?
|
||||
<div className='incompatible-video'>
|
||||
<p>incompatible video</p>
|
||||
</div>
|
||||
:null
|
||||
}
|
||||
|
||||
<div className='controls'>
|
||||
<div
|
||||
className={classnames('button', 'fullscreen')}
|
||||
onClick={(e) =>
|
||||
{
|
||||
e.stopPropagation();
|
||||
toggleConsumerFullscreen(consumer);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<FullView
|
||||
advancedMode={advancedMode}
|
||||
videoTrack={consumer ? consumer.track : null}
|
||||
videoVisible={consumerVisible}
|
||||
videoProfile={consumerProfile}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
FullScreenView.propTypes =
|
||||
{
|
||||
advancedMode : PropTypes.bool,
|
||||
consumer : appPropTypes.Consumer,
|
||||
toggleConsumerFullscreen : PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) =>
|
||||
{
|
||||
return {
|
||||
consumer : state.consumers[state.room.fullScreenConsumer]
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
{
|
||||
return {
|
||||
toggleConsumerFullscreen : (consumer) =>
|
||||
{
|
||||
if (consumer)
|
||||
dispatch(stateActions.toggleConsumerFullscreen(consumer.id));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const FullScreenViewContainer = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(FullScreenView);
|
||||
|
||||
export default FullScreenViewContainer;
|
||||
|
|
@ -22,7 +22,7 @@ export default class FullView extends React.Component
|
|||
} = this.props;
|
||||
|
||||
return (
|
||||
<div data-component='ScreenView'>
|
||||
<div data-component='FullView'>
|
||||
<video
|
||||
ref='video'
|
||||
className={classnames({
|
||||
|
|
|
|||
|
|
@ -78,11 +78,6 @@ class Me extends React.Component
|
|||
if (!me.displayNameSet)
|
||||
tip = 'Click on your name to change it';
|
||||
|
||||
const style =
|
||||
{
|
||||
'width' : screenProducer ? '40vmin' : ''
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
data-component='Me'
|
||||
|
|
@ -90,7 +85,6 @@ class Me extends React.Component
|
|||
data-tip={tip}
|
||||
data-tip-disable={!tip}
|
||||
data-type='dark'
|
||||
style={style}
|
||||
>
|
||||
<div className={classnames('view-container', 'webcam')}>
|
||||
{connected ?
|
||||
|
|
|
|||
|
|
@ -226,7 +226,8 @@ const mapDispatchToProps = (dispatch) =>
|
|||
},
|
||||
toggleConsumerFullscreen : (consumer) =>
|
||||
{
|
||||
dispatch(stateActions.toggleConsumerFullscreen(consumer));
|
||||
if (consumer)
|
||||
dispatch(stateActions.toggleConsumerFullscreen(consumer.id));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ class Peers extends React.Component
|
|||
|
||||
componentWillReceiveProps(nextProps)
|
||||
{
|
||||
if (nextProps.videoStreams)
|
||||
this.updateDimensions(nextProps);
|
||||
this.updateDimensions(nextProps);
|
||||
}
|
||||
|
||||
render()
|
||||
|
|
@ -83,7 +82,8 @@ class Peers extends React.Component
|
|||
const {
|
||||
advancedMode,
|
||||
activeSpeakerName,
|
||||
peers
|
||||
peers,
|
||||
toolAreaOpen
|
||||
} = this.props;
|
||||
|
||||
const style =
|
||||
|
|
@ -108,6 +108,7 @@ class Peers extends React.Component
|
|||
advancedMode={advancedMode}
|
||||
name={peer.name}
|
||||
style={style}
|
||||
toolAreaOpen={toolAreaOpen}
|
||||
/>
|
||||
</div>
|
||||
</Appear>
|
||||
|
|
@ -124,7 +125,8 @@ Peers.propTypes =
|
|||
advancedMode : PropTypes.bool,
|
||||
peers : PropTypes.arrayOf(appPropTypes.Peer).isRequired,
|
||||
videoStreams : PropTypes.any,
|
||||
activeSpeakerName : PropTypes.string
|
||||
activeSpeakerName : PropTypes.string,
|
||||
toolAreaOpen : PropTypes.bool
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) =>
|
||||
|
|
@ -140,7 +142,8 @@ const mapStateToProps = (state) =>
|
|||
return {
|
||||
peers : peersArray,
|
||||
videoStreams : videoStreams,
|
||||
activeSpeakerName : state.room.activeSpeakerName
|
||||
activeSpeakerName : state.room.activeSpeakerName,
|
||||
toolAreaOpen : state.toolarea.toolAreaOpen
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import Peers from './Peers';
|
|||
import Notifications from './Notifications';
|
||||
import ToolAreaButton from './ToolArea/ToolAreaButton';
|
||||
import ToolArea from './ToolArea/ToolArea';
|
||||
import FullScreenView from './FullScreenView';
|
||||
|
||||
class Room extends React.Component
|
||||
{
|
||||
|
|
@ -59,6 +60,7 @@ class Room extends React.Component
|
|||
return (
|
||||
<Appear duration={300}>
|
||||
<div data-component='Room'>
|
||||
<FullScreenView advancedMode={room.advancedMode} />
|
||||
<div
|
||||
className='room-wrapper'
|
||||
style={{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
const initialState =
|
||||
{
|
||||
url : null,
|
||||
state : 'new', // new/connecting/connected/disconnected/closed,
|
||||
activeSpeakerName : null,
|
||||
showSettings : false,
|
||||
advancedMode : false
|
||||
url : null,
|
||||
state : 'new', // new/connecting/connected/disconnected/closed,
|
||||
activeSpeakerName : null,
|
||||
showSettings : false,
|
||||
advancedMode : false,
|
||||
fullScreenConsumer : null // ConsumerID
|
||||
};
|
||||
|
||||
const room = (state = initialState, action) =>
|
||||
|
|
@ -49,6 +50,14 @@ const room = (state = initialState, action) =>
|
|||
return { ...state, advancedMode };
|
||||
}
|
||||
|
||||
case 'TOGGLE_FULLSCREEN_CONSUMER':
|
||||
{
|
||||
const { consumerId } = action.payload;
|
||||
const currentConsumer = state.fullScreenConsumer;
|
||||
|
||||
return { ...state, fullScreenConsumer: currentConsumer ? null : consumerId };
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,6 +361,14 @@ export const toggleChat = () =>
|
|||
};
|
||||
};
|
||||
|
||||
export const toggleConsumerFullscreen = (consumerId) =>
|
||||
{
|
||||
return {
|
||||
type : 'TOGGLE_FULLSCREEN_CONSUMER',
|
||||
payload : { consumerId }
|
||||
};
|
||||
};
|
||||
|
||||
export const increaseBadge = () =>
|
||||
{
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
max-width: 300px;
|
||||
right: 0;
|
||||
width: 90vw;
|
||||
z-index: 9999;
|
||||
z-index: 100;
|
||||
|
||||
> .launcher {
|
||||
align-self: flex-end;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
[data-component='FullScreenView'] {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 200;
|
||||
|
||||
> .controls {
|
||||
position: absolute;
|
||||
z-index: 201;
|
||||
right: 0;
|
||||
top: 0;
|
||||
display: flex;
|
||||
flex-direction:; row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 0.4vmin;
|
||||
|
||||
> .button {
|
||||
flex: 0 0 auto;
|
||||
margin: 0.2vmin;
|
||||
border-radius: 2px;
|
||||
background-position: center;
|
||||
background-size: 75%;
|
||||
background-repeat: no-repeat;
|
||||
background-color: rgba(#000, 0.5);
|
||||
cursor: pointer;
|
||||
transition-property: opacity, background-color;
|
||||
transition-duration: 0.15s;
|
||||
|
||||
+desktop() {
|
||||
width: 5vmin;
|
||||
height: 5vmin;
|
||||
opacity: 0.85;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
+mobile() {
|
||||
width: 5vmin;
|
||||
height: 5vmin;
|
||||
}
|
||||
|
||||
&.fullscreen {
|
||||
background-image: url('/resources/images/icon_fullscreen_exit_black.svg');
|
||||
background-color: rgba(#fff, 0.7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.incompatible-video {
|
||||
position: absolute;
|
||||
z-index: 2
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
> p {
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
font-size: 15px;
|
||||
color: rgba(#fff, 0.55);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
[data-component='FullView'] {
|
||||
position: relative;
|
||||
flex: 100 100 auto;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background-color: rgba(#2a4b58, 0.9);
|
||||
background-image: url('/resources/images/buddy.svg');
|
||||
background-position: bottom;
|
||||
background-size: auto 85%;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
> .info {
|
||||
$backgroundTint = #000;
|
||||
|
||||
position: absolute;
|
||||
z-index: 5
|
||||
top: 0.6vmin;
|
||||
left: 0.6vmin;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
> .media {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
> .box {
|
||||
padding: 0.4vmin;
|
||||
border-radius: 2px;
|
||||
background-color: rgba(#000, 0.25);
|
||||
|
||||
> p {
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
margin-bottom: 2px;
|
||||
color: rgba(#fff, 0.7);
|
||||
font-size: 10px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> video {
|
||||
flex: 100 100 auto;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
object-fit: contain;
|
||||
user-select: none;
|
||||
transition-property: opacity;
|
||||
transition-duration: .15s;
|
||||
background-color: rgba(#000, 0.75);
|
||||
|
||||
&.hidden {
|
||||
opacity: 0;
|
||||
transition-duration: 0s;
|
||||
}
|
||||
|
||||
&.loading {
|
||||
filter: blur(5px);
|
||||
}
|
||||
}
|
||||
|
||||
> .spinner-container {
|
||||
position: absolute;
|
||||
top: 0
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: rgba(#000, 0.75);
|
||||
|
||||
.react-spinner {
|
||||
position: relative;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
.react-spinner_bar {
|
||||
position: absolute;
|
||||
width: 20%;
|
||||
height: 7.8%;
|
||||
top: -3.9%;
|
||||
left: -10%;
|
||||
animation: PeerView-spinner 1.2s linear infinite;
|
||||
border-radius: 5px;
|
||||
background-color: rgba(#fff, 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes FullView-spinner {
|
||||
0% { opacity: 1; }
|
||||
100% { opacity: 0.15; }
|
||||
}
|
||||
|
|
@ -1,15 +1,13 @@
|
|||
[data-component='Me'] {
|
||||
flex: 100 100 auto;
|
||||
position: relative;
|
||||
height: 15vmin;
|
||||
width: 20vmin;
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
|
||||
> .view-container {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
width: 20vmin;
|
||||
height: 15vmin;
|
||||
|
||||
&.webcam {
|
||||
order: 2;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ body {
|
|||
@import './components/Settings';
|
||||
@import './components/ToolArea';
|
||||
@import './components/ParticipantList';
|
||||
@import './components/FullScreenView';
|
||||
@import './components/FullView';
|
||||
}
|
||||
|
||||
// Hack to detect in JS the current media query
|
||||
|
|
|
|||
Loading…
Reference in New Issue