get thumbnail address for mp4 edits

This commit is contained in:
Travis Eden 2018-10-17 10:07:06 -04:00
parent 3daf0ce214
commit 97de13527a

View file

@ -2,6 +2,9 @@ import { connect } from 'react-redux';
import { selectFile, updateError, clearFile } from '../../actions/publish'; import { selectFile, updateError, clearFile } from '../../actions/publish';
import { selectAsset } from '../../selectors/show'; import { selectAsset } from '../../selectors/show';
import View from './view'; import View from './view';
import siteConfig from '@config/siteConfig.json';
const { assetDefaults: { thumbnail: defaultThumbnail } } = siteConfig;
const mapStateToProps = ({ show, publish: { file, thumbnail, fileError, isUpdate } }) => { const mapStateToProps = ({ show, publish: { file, thumbnail, fileError, isUpdate } }) => {
const obj = { file, thumbnail, fileError, isUpdate }; const obj = { file, thumbnail, fileError, isUpdate };
@ -9,11 +12,12 @@ const mapStateToProps = ({ show, publish: { file, thumbnail, fileError, isUpdate
if (isUpdate) { if (isUpdate) {
asset = selectAsset(show); asset = selectAsset(show);
if (asset) { if (asset) {
if (asset.claimData.fileExt === 'mp4') {
obj.sourceUrl = asset.claimData.thumbnail ? asset.claimData.thumbnail : defaultThumbnail;
} else {
({name, claimData: {claimId, fileExt, outpoint}} = asset); ({name, claimData: {claimId, fileExt, outpoint}} = asset);
sourceUrl = `/${claimId}/${name}.${fileExt}?${outpoint}`; obj.sourceUrl = `/${claimId}/${name}.${fileExt}?${outpoint}`;
} }
if (sourceUrl) {
obj.sourceUrl = sourceUrl;
} }
} }
return obj; return obj;