Sync loading between file actions and video player

This commit is contained in:
6ea86b96 2017-06-02 14:40:40 +07:00
parent 8505959c22
commit 912933d4e7
No known key found for this signature in database
GPG key ID: B282D183E4931E8F
3 changed files with 5 additions and 4 deletions

View file

@ -43,6 +43,7 @@ const makeSelect = () => {
const selectIsAvailableForUri = makeSelectIsAvailableForUri() const selectIsAvailableForUri = makeSelectIsAvailableForUri()
const selectDownloadingForUri = makeSelectDownloadingForUri() const selectDownloadingForUri = makeSelectDownloadingForUri()
const selectCostInfoForUri = makeSelectCostInfoForUri() const selectCostInfoForUri = makeSelectCostInfoForUri()
const selectLoadingForUri = makeSelectLoadingForUri()
const select = (state, props) => ({ const select = (state, props) => ({
fileInfo: selectFileInfoForUri(state, props), fileInfo: selectFileInfoForUri(state, props),
@ -51,6 +52,7 @@ const makeSelect = () => {
modal: selectCurrentModal(state), modal: selectCurrentModal(state),
downloading: selectDownloadingForUri(state, props), downloading: selectDownloadingForUri(state, props),
costInfo: selectCostInfoForUri(state, props), costInfo: selectCostInfoForUri(state, props),
loading: selectLoadingForUri(state, props),
}) })
return select return select

View file

@ -63,6 +63,7 @@ class FileActions extends React.Component {
closeModal, closeModal,
startDownload, startDownload,
costInfo, costInfo,
loading,
} = this.props } = this.props
const deleteChecked = this.state.deleteChecked, const deleteChecked = this.state.deleteChecked,
@ -73,9 +74,7 @@ class FileActions extends React.Component {
let content let content
console.log(fileInfo) if (loading || downloading) {
if (downloading) {
const const
progress = (fileInfo && fileInfo.written_bytes) ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0, progress = (fileInfo && fileInfo.written_bytes) ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0,

View file

@ -126,7 +126,7 @@ class Video extends React.Component {
return ( return (
<div className={klassName}>{ <div className={klassName}>{
isPlaying || isLoading ? isPlaying ?
(!isReadyToPlay ? (!isReadyToPlay ?
<span>this is the world's worst loading screen and we shipped our software with it anyway... <br /><br />{loadStatusMessage}</span> : <span>this is the world's worst loading screen and we shipped our software with it anyway... <br /><br />{loadStatusMessage}</span> :
<VideoPlayer filename={fileInfo.file_name} poster={poster} downloadPath={fileInfo.download_path} mediaType={mediaType} poster={poster} />) : <VideoPlayer filename={fileInfo.file_name} poster={poster} downloadPath={fileInfo.download_path} mediaType={mediaType} poster={poster} />) :