get thumbnail address for mp4 edits
This commit is contained in:
parent
3daf0ce214
commit
97de13527a
1 changed files with 9 additions and 5 deletions
|
@ -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) {
|
||||||
({name, claimData: {claimId, fileExt, outpoint}} = asset);
|
if (asset.claimData.fileExt === 'mp4') {
|
||||||
sourceUrl = `/${claimId}/${name}.${fileExt}?${outpoint}`;
|
obj.sourceUrl = asset.claimData.thumbnail ? asset.claimData.thumbnail : defaultThumbnail;
|
||||||
}
|
} else {
|
||||||
if (sourceUrl) {
|
({name, claimData: {claimId, fileExt, outpoint}} = asset);
|
||||||
obj.sourceUrl = sourceUrl;
|
obj.sourceUrl = `/${claimId}/${name}.${fileExt}?${outpoint}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
|
|
Loading…
Add table
Reference in a new issue