Skip to content
Snippets Groups Projects
Select Git revision
  • 1fe39ee0e2a05aabf3c0833c3c45e5fd0f132c73
  • master default protected
  • 12-dot-genere-non-coherent
  • unl-tools-release-0.9
  • v0.9
5 results

unlTools.iml

Blame
  • VideoViewer.js 1.59 KiB
    import { connect } from 'react-redux';
    import { compose } from 'redux';
    import { withTranslation } from 'react-i18next';
    import { withStyles } from '@material-ui/core';
    import { withPlugins } from '../extend/withPlugins';
    import * as actions from '../state/actions';
    import { VideoViewer } from '../components/VideoViewer';
    import {
      getCurrentCanvas,
      getCurrentCanvasWorld,
      getWindowMutedStatus,
      getWindowPausedStatus,
      getWindowCurrentTime,
    } from '../state/selectors';
    
    /** */
    const mapStateToProps = (state, { windowId }) => ({
      canvas: (getCurrentCanvas(state, { windowId }) || {}),
      canvasWorld: getCurrentCanvasWorld(state, { windowId }),
      currentTime: getWindowCurrentTime(state, { windowId }),
      muted: getWindowMutedStatus(state, { windowId }),
      paused: getWindowPausedStatus(state, { windowId }),
    });
    
    /** */
    const mapDispatchToProps = (dispatch, { windowId }) => ({
      setCurrentTime: (...args) => dispatch(actions.setWindowCurrentTime(windowId, ...args)),
      setPaused: (...args) => dispatch(actions.setWindowPaused(windowId, ...args)),
    });
    
    /** */
    const styles = () => ({
      flexContainer: {
        alignItems: 'center',
        display: 'flex',
        width: '100%',
      },
      flexFill: {
        height: '100%',
        position: 'relative',
        width: '100%',
      },
      video: {
        height: '100%',
        maxHeight: '100%',
        maxWidth: '100%',
        'object-fit': 'scale-down',
        'object-position': 'left top',
        width: '100%',
      },
    });
    
    const enhance = compose(
      withTranslation(),
      withStyles(styles),
      connect(mapStateToProps, mapDispatchToProps),
      withPlugins('VideoViewer'),
    );
    
    export default enhance(VideoViewer);