2019-03-19 15:42:25 +00:00
|
|
|
// @flow
|
2017-09-05 22:45:20 +00:00
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { View } from 'react-native';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import { VideoTrack } from '../../base/media';
|
2017-12-14 15:04:35 +00:00
|
|
|
import { TintedView } from '../../base/react';
|
2017-09-05 22:45:20 +00:00
|
|
|
import { getLocalVideoTrack } from '../../base/tracks';
|
|
|
|
|
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link LocalVideoTrackUnderlay}.
|
2017-09-05 22:45:20 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
type Props = {
|
2017-09-05 22:45:20 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The redux representation of the local participant's video track.
|
|
|
|
*/
|
|
|
|
_localVideoTrack: Object,
|
2017-09-05 22:45:20 +00:00
|
|
|
|
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* React Elements to display within the component.
|
|
|
|
*/
|
|
|
|
children: React$Node,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The style, if any, to apply to {@link LocalVideoTrackUnderlay} in
|
|
|
|
* addition to its default style.
|
|
|
|
*/
|
|
|
|
style: Object
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a React {@code Component} which underlays the local video track,
|
|
|
|
* if any, underneath its children.
|
|
|
|
*/
|
2018-11-29 23:30:52 +00:00
|
|
|
class LocalVideoTrackUnderlay extends Component<Props> {
|
2017-09-05 22:45:20 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @override
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
2018-11-29 23:30:52 +00:00
|
|
|
<View
|
|
|
|
style = { [
|
|
|
|
styles.localVideoTrackUnderlay,
|
|
|
|
this.props.style
|
|
|
|
] }>
|
2017-09-05 22:45:20 +00:00
|
|
|
<VideoTrack videoTrack = { this.props._localVideoTrack } />
|
2017-12-14 15:04:35 +00:00
|
|
|
<TintedView>
|
2017-09-05 22:45:20 +00:00
|
|
|
{ this.props.children }
|
2017-12-14 15:04:35 +00:00
|
|
|
</TintedView>
|
2017-09-05 22:45:20 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the React {@code Component} props of
|
|
|
|
* {@code LocalVideoTrackUnderlay}.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
|
|
|
* _localVideoTrack: (Track|undefined)
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
|
|
|
_localVideoTrack: getLocalVideoTrack(state['features/base/tracks'])
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-03-19 15:42:25 +00:00
|
|
|
// $FlowExpectedError
|
2017-09-05 22:45:20 +00:00
|
|
|
export default connect(_mapStateToProps)(LocalVideoTrackUnderlay);
|