@bbc/react-transcript-editor
Version:
A React component to make transcribing audio and video easier and faster.
51 lines (42 loc) • 1.59 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import React from 'react';
import styles from './index.module.css';
import TimedTextEditor from './TimedTextEditor/index.js';
import MediaPlayer from './MediaPlayer/index.js';
class TranscriptEditor extends React.Component {
constructor(props) {
super(props);
_defineProperty(this, "handleWordClick", startTime => {
this.setCurrentTime(startTime);
});
_defineProperty(this, "handleTimeUpdate", currentTime => {
this.setState({
currentTime: currentTime
});
});
this.state = {
currentTime: 0
};
} // eslint-disable-next-line class-methods-use-this
render() {
return React.createElement("section", {
className: styles.container
}, React.createElement("aside", {
className: styles.aside
}, React.createElement(MediaPlayer // eslint-disable-next-line no-return-assign
, {
hookSeek: foo => this.setCurrentTime = foo,
hookOnTimeUpdate: this.handleTimeUpdate,
mediaUrl: this.props.mediaUrl
})), React.createElement("main", {
className: styles.main
}, React.createElement(TimedTextEditor, {
transcriptData: this.props.transcriptData,
onWordClick: this.handleWordClick,
currentTime: this.state.currentTime,
isEditable: this.props.isEditable,
sttJsonType: this.props.sttJsonType
})));
}
}
export default TranscriptEditor;