From 2bb9b1836f26d7c74cd02c2c2a349ecc02c5dcee Mon Sep 17 00:00:00 2001 From: bill bittner Date: Fri, 2 Mar 2018 15:14:02 -0800 Subject: [PATCH] changed video source to be stored as a thumbnail --- react/containers/PublishThumbnailInput/view.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/react/containers/PublishThumbnailInput/view.jsx b/react/containers/PublishThumbnailInput/view.jsx index 408d2718..96de93fb 100644 --- a/react/containers/PublishThumbnailInput/view.jsx +++ b/react/containers/PublishThumbnailInput/view.jsx @@ -43,7 +43,10 @@ class PublishThumbnailInput extends React.Component { previewReader.readAsDataURL(file); previewReader.onloadend = () => { console.log('preview reader complete'); - this.setState({videoSource: previewReader.result}); + const dataUri = previewReader.result; + const blob = dataURItoBlob(dataUri); + const videoSource = URL.createObjectURL(blob); + this.setState({ videoSource }); }; } handleVideoLoadedData (event) { @@ -75,7 +78,7 @@ class PublishThumbnailInput extends React.Component { canvas.height = video.videoHeight; canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height); const dataUrl = canvas.toDataURL(); - const snapshot = dataURItoBlob(dataUrl) + const snapshot = dataURItoBlob(dataUrl); // set the thumbnail in redux store if (snapshot) { this.props.onNewThumbnail(snapshot);