Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	File size: 4,354 Bytes
			
			| 6bcb42f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | import PropTypes from 'prop-types';
import React from 'react';
import Box from '../box/box.jsx';
import Waveform from '../waveform/waveform.jsx';
import Meter from '../meter/meter.jsx';
import AudioTrimmer from '../../containers/audio-trimmer.jsx';
import {defineMessages, injectIntl, intlShape} from 'react-intl';
import styles from './record-modal.css';
import backIcon from './icon--back.svg';
import stopIcon from './icon--stop-playback.svg';
import playIcon from './icon--play.svg';
const messages = defineMessages({
    stopMsg: {
        defaultMessage: 'Stop',
        description: 'Stop/Play button in recording playback',
        id: 'gui.playbackStep.stopMsg'
    },
    playMsg: {
        defaultMessage: 'Play',
        description: 'Stop/Play button in recording playback',
        id: 'gui.playbackStep.playMsg'
    },
    loadingMsg: {
        defaultMessage: 'Loading...',
        description: 'Loading/Save button in recording playback',
        id: 'gui.playbackStep.loadingMsg'
    },
    saveMsg: {
        defaultMessage: 'Save',
        description: 'Loading/Save button in recording playback',
        id: 'gui.playbackStep.saveMsg'
    },
    reRecordMsg: {
        defaultMessage: 'Re-record',
        description: 'Button to re-record sound in recording playback',
        id: 'gui.playbackStep.reRecordMsg'
    }
});
const PlaybackStep = props => (
    <Box>
        <Box className={styles.visualizationContainer}>
            <Box className={styles.meterContainer}>
                <Meter
                    height={172}
                    level={0}
                    width={20}
                />
            </Box>
            <Box className={styles.waveformContainer}>
                <Waveform
                    data={props.levels}
                    height={150}
                    level={0}
                    width={480}
                />
                <AudioTrimmer
                    playhead={props.playhead}
                    trimEnd={props.trimEnd}
                    trimStart={props.trimStart}
                    onSetTrimEnd={props.onSetTrimEnd}
                    onSetTrimStart={props.onSetTrimStart}
                />
            </Box>
        </Box>
        <Box className={styles.mainButtonRow}>
            <button
                className={styles.mainButton}
                onClick={props.playing ? props.onStopPlaying : props.onPlay}
            >
                <img
                    draggable={false}
                    src={props.playing ? stopIcon : playIcon}
                />
                <div className={styles.helpText}>
                    <span className={styles.playingText}>
                        {props.playing ?
                            props.intl.formatMessage(messages.stopMsg) :
                            props.intl.formatMessage(messages.playMsg)
                        }
                    </span>
                </div>
            </button>
        </Box>
        <Box className={styles.buttonRow}>
            <button
                className={styles.rerecordButton}
                onClick={props.onBack}
            >
                <img
                    draggable={false}
                    src={backIcon}
                />
                {props.intl.formatMessage(messages.reRecordMsg)}
            </button>
            <button
                className={styles.okButton}
                disabled={props.encoding}
                onClick={props.onSubmit}
            >
                {props.encoding ?
                    props.intl.formatMessage(messages.loadingMsg) :
                    props.intl.formatMessage(messages.saveMsg)
                }
            </button>
        </Box>
    </Box>
);
PlaybackStep.propTypes = {
    encoding: PropTypes.bool.isRequired,
    intl: intlShape.isRequired,
    levels: PropTypes.arrayOf(PropTypes.number).isRequired,
    onBack: PropTypes.func.isRequired,
    onPlay: PropTypes.func.isRequired,
    onSetTrimEnd: PropTypes.func.isRequired,
    onSetTrimStart: PropTypes.func.isRequired,
    onStopPlaying: PropTypes.func.isRequired,
    onSubmit: PropTypes.func.isRequired,
    playhead: PropTypes.number,
    playing: PropTypes.bool.isRequired,
    trimEnd: PropTypes.number.isRequired,
    trimStart: PropTypes.number.isRequired
};
export default injectIntl(PlaybackStep);
 | 
