'use strict'; import React from 'react'; import Button from 'react-bootstrap/lib/Button'; import ProgressBar from 'react-bootstrap/lib/ProgressBar'; import MediaPlayer from './../ascribe_media/media_player'; import FacebookShareButton from '../ascribe_social_share/facebook_share_button'; import TwitterShareButton from '../ascribe_social_share/twitter_share_button'; import S3DownloadButton from '../ascribe_buttons/s3_download_button'; import CollapsibleButton from './../ascribe_collapsible/collapsible_button'; import AscribeSpinner from '../ascribe_spinner'; import AclProxy from '../acl_proxy'; import AppConstants from '../../constants/application_constants'; import { getLangText } from '../../utils/lang_utils'; import { extractFileExtensionFromUrl } from '../../utils/file_utils'; const EMBED_IFRAME_HEIGHT = { video: 315, audio: 62 }; let MediaContainer = React.createClass({ propTypes: { content: React.PropTypes.object.isRequired, refreshObject: React.PropTypes.func.isRequired, currentUser: React.PropTypes.object }, getInitialState() { return { timerId: null }; }, componentDidMount() { const { content: { digital_work: digitalWork }, refreshObject } = this.props; const { timerId } = this.state; if (digitalWork && (this.isVideoEncoding() || this.isImageEncoding()) && !timerId) { this.setState({ timerId: window.setInterval(refreshObject, AppConstants.encodeUpdateThreshold) }); } }, componentWillUpdate() { const { timerId } = this.state; if (!(this.isVideoEncoding() || this.isImageEncoding()) && timerId) { window.clearInterval(timerId); } }, componentWillUnmount() { window.clearInterval(this.state.timerId); }, isVideoEncoding() { const { content: { digital_work: digitalWork } } = this.props; return digitalWork.mime === 'video' && typeof digitalWork.isEncoding === 'number' && digitalWork.isEncoding !== 100; }, isImageEncoding() { const { content: { thumbnail, digital_work: digitalWork } } = this.props; const thumbnailToCheck = thumbnail.thumbnail_sizes && thumbnail.thumbnail_sizes['600x600'] ? thumbnail.thumbnail_sizes['600x600'] : thumbnail.url; const thumbnailFileExtension = extractFileExtensionFromUrl(thumbnailToCheck); return digitalWork.mime === 'image' && (thumbnailFileExtension === 'tif' || thumbnailFileExtension === 'tiff'); }, getEncodingMessage() { if (this.isVideoEncoding()) { const { content: { digital_work: digitalWork } } = this.props; return (
We successfully received your video and it is now being encoded.
You can leave this page and check back on the status later.
{''}} /> ); } return (