You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LocalVideoTrackUnderlay.native.js 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { View } from 'react-native';
  4. import { VideoTrack } from '../../base/media';
  5. import { TintedView } from '../../base/react';
  6. import { connect } from '../../base/redux';
  7. import { getLocalVideoTrack } from '../../base/tracks';
  8. import styles from './styles';
  9. /**
  10. * The type of the React {@code Component} props of
  11. * {@link LocalVideoTrackUnderlay}.
  12. */
  13. type Props = {
  14. /**
  15. * The redux representation of the local participant's video track.
  16. */
  17. _localVideoTrack: Object,
  18. /**
  19. * React Elements to display within the component.
  20. */
  21. children: React$Node,
  22. /**
  23. * The style, if any, to apply to {@link LocalVideoTrackUnderlay} in
  24. * addition to its default style.
  25. */
  26. style: Object
  27. };
  28. /**
  29. * Implements a React {@code Component} which underlays the local video track,
  30. * if any, underneath its children.
  31. */
  32. class LocalVideoTrackUnderlay extends Component<Props> {
  33. /**
  34. * Implements React's {@link Component#render()}.
  35. *
  36. * @inheritdoc
  37. * @override
  38. * @returns {ReactElement}
  39. */
  40. render() {
  41. return (
  42. <View
  43. style = { [
  44. styles.localVideoTrackUnderlay,
  45. this.props.style
  46. ] }>
  47. <VideoTrack videoTrack = { this.props._localVideoTrack } />
  48. <TintedView>
  49. { this.props.children }
  50. </TintedView>
  51. </View>
  52. );
  53. }
  54. }
  55. /**
  56. * Maps (parts of) the redux state to the React {@code Component} props of
  57. * {@code LocalVideoTrackUnderlay}.
  58. *
  59. * @param {Object} state - The redux state.
  60. * @private
  61. * @returns {{
  62. * _localVideoTrack: (Track|undefined)
  63. * }}
  64. */
  65. function _mapStateToProps(state) {
  66. return {
  67. _localVideoTrack: getLocalVideoTrack(state['features/base/tracks'])
  68. };
  69. }
  70. export default connect(_mapStateToProps)(LocalVideoTrackUnderlay);