mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Remove unnecessary duplication of updating encoding status in Edition
Also reduces the time between each update to 5s since 10s feels way too long.
This commit is contained in:
commit
cc9fa2378f
@ -73,14 +73,6 @@ let EditionContainer = React.createClass({
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
|
||||
if (state && state.edition && state.edition.digital_work) {
|
||||
const isEncoding = state.edition.digital_work.isEncoding;
|
||||
if (state.edition.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
||||
const timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
|
||||
this.setState({ timerId: timerId });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
render() {
|
||||
|
@ -20,6 +20,7 @@ const EMBED_IFRAME_HEIGHT = {
|
||||
video: 315,
|
||||
audio: 62
|
||||
};
|
||||
const ENCODE_UPDATE_TIME = 5000;
|
||||
|
||||
let MediaContainer = React.createClass({
|
||||
propTypes: {
|
||||
@ -36,15 +37,15 @@ let MediaContainer = React.createClass({
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
const { content, refreshObject } = this.props;
|
||||
if (!content.digital_work) {
|
||||
return;
|
||||
}
|
||||
const { content: { digital_work: digitalWork }, refreshObject } = this.props;
|
||||
|
||||
const isEncoding = content.digital_work.isEncoding;
|
||||
if (content.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
||||
const timerId = window.setInterval(refreshObject, 10000);
|
||||
this.setState({timerId: timerId});
|
||||
if (digitalWork) {
|
||||
const isEncoding = digitalWork.isEncoding;
|
||||
|
||||
if (digitalWork.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
||||
const timerId = window.setInterval(refreshObject, ENCODE_UPDATE_TIME);
|
||||
this.setState({ timerId: timerId });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user