Skip to content
Snippets Groups Projects
Select Git revision
  • 903a1dfdd28c85c75e5f562ba8e8890ce34fd3e0
  • annotation-on-video default protected
  • demo_ci
  • 3-upstream-01022023
  • master
  • gh3538-captions
  • 16-adapt-for-images-annot
  • 15-api-for-annotations-on-video
  • 15-annotations-on-videos
  • video_for_annotations
  • wip-1-annotations-on-videos
  • 9-videoviewer-tests
  • 9_wip_videotests
  • 6-fix-tests-and-ci
  • _fix_ci
  • wip-webpack-from-git
16 results

sequence_switching.test.js

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);