Composer: display uploaded video preview
This commit is contained in:
parent
3bae6e25e1
commit
80c18f0fed
|
@ -108,7 +108,7 @@ class Upload extends ImmutablePureComponent {
|
||||||
className={classNames('compose-form__upload-thumbnail', `${mediaType}`)}
|
className={classNames('compose-form__upload-thumbnail', `${mediaType}`)}
|
||||||
style={{
|
style={{
|
||||||
transform: `scale(${scale})`,
|
transform: `scale(${scale})`,
|
||||||
backgroundImage: (mediaType !== 'video' && mediaType !== 'audio' ? `url(${media.get('preview_url')})` : null),
|
backgroundImage: mediaType === 'image' ? `url(${media.get('preview_url')})`: null,
|
||||||
backgroundPosition: `${x}% ${y}%` }}
|
backgroundPosition: `${x}% ${y}%` }}
|
||||||
>
|
>
|
||||||
<div className={classNames('compose-form__upload__actions', { active })}>
|
<div className={classNames('compose-form__upload__actions', { active })}>
|
||||||
|
@ -131,6 +131,14 @@ class Upload extends ImmutablePureComponent {
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='compose-form__upload-preview'>
|
||||||
|
{mediaType === 'video' && (
|
||||||
|
<video autoPlay playsInline muted loop>
|
||||||
|
<source src={media.get('preview_url')} />
|
||||||
|
</video>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Motion>
|
</Motion>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import UploadButton from '../components/upload_button';
|
||||||
import { uploadCompose } from '../../../actions/compose';
|
import { uploadCompose } from '../../../actions/compose';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
|
disabled: state.getIn(['compose', 'is_uploading']),
|
||||||
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -277,15 +277,33 @@
|
||||||
}
|
}
|
||||||
&.active { opacity: 1; }
|
&.active { opacity: 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-preview {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: -1;
|
||||||
|
|
||||||
|
video {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.compose-form__upload-thumbnail {
|
.compose-form__upload-thumbnail {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
height: 140px;
|
height: 160px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
&.video {
|
&.video {
|
||||||
background-image: url('../images/video-placeholder.png');
|
background-image: url('../images/video-placeholder.png');
|
||||||
|
|
Loading…
Reference in New Issue