diff --git a/app/components/projects/CreateProject.jsx b/app/components/projects/CreateProject.jsx index b905b5f..e15cd6b 100644 --- a/app/components/projects/CreateProject.jsx +++ b/app/components/projects/CreateProject.jsx @@ -92,10 +92,12 @@ const createJSON = values => { description, media: { isPlaying, - url: formatMedia(video), type: 'video' } } + + if (isWeb(video)) Object.assign(manifest.media, { url: formatMedia(video) }) + else Object.assign(manifest.media, { file: formatMedia(video) }) return JSON.stringify(manifest, null, 2) } @@ -204,6 +206,23 @@ const SubmissionSection = ({ classes }) => { onBlur={handleBlur} value={values.title || ''} /> + { onBlur={handleBlur} value={values.commitTime || ''} /> - assets ? JSON.parse(assets.find(a => a.name.toLowerCase() === 'manifest.json').content) : null const formatMedia = content => { - const blob = new Blob([content], {type : 'video/mp4'}) - return URL.createObjectURL(blob) + const type = 'video/mp4' + const blob = new Blob([content], {type}) + const src = URL.createObjectURL(blob) + return src } const getMediaType = assets => { @@ -157,6 +159,7 @@ const getMediaType = assets => { if (media.type.toLowerCase().includes('video')) return true } +const getFile = filePath => filePath.split('/').slice(-1)[0] const getMediaSrc = assets => { if (!assets) return null const { media } = getProjectManifest(assets) @@ -164,13 +167,12 @@ const getMediaSrc = assets => { if (media.url) return media.url if (media.file) { return formatMedia( - assets.find(a => a.name === media.file).content + assets.find(a => a.name === getFile(media.file)).content ) } } } - function Project({ classes, match, profile, transfers, pledges, projectAddedEvents }) { const projectId = match.params.id const { projectAge, projectAssets, manifest } = useProjectData(projectId, profile, projectAddedEvents) @@ -204,7 +206,7 @@ function Project({ classes, match, profile, transfers, pledges, projectAddedEven
{mediaType - ? + ? :