Playing videos working better
This commit is contained in:
parent
4754ba3da2
commit
356393330a
5 changed files with 26 additions and 11 deletions
|
@ -275,11 +275,7 @@ export function doWatchVideo() {
|
|||
const { cost } = costInfo
|
||||
|
||||
// TODO does > 0 mean the file is downloaded? We don't have the total_bytes
|
||||
console.log(fileInfo)
|
||||
console.log(fileInfo.written_bytes)
|
||||
console.log('wtf')
|
||||
if (fileInfo.written_bytes > 0) {
|
||||
console.debug('this file is already downloaded')
|
||||
dispatch(doPlayVideo(uri))
|
||||
} else {
|
||||
if (cost > balance) {
|
||||
|
|
|
@ -16,12 +16,8 @@ import {
|
|||
selectLoadingCurrentUri,
|
||||
selectCurrentUriFileReadyToPlay,
|
||||
selectCurrentUriIsPlaying,
|
||||
selectCurrentUriFileInfo,
|
||||
selectDownloadingCurrentUri,
|
||||
} from 'selectors/file_info'
|
||||
import {
|
||||
selectCurrentUriCostInfo,
|
||||
} from 'selectors/cost_info'
|
||||
} from 'selectors/content'
|
||||
import Video from './view'
|
||||
|
||||
const select = (state) => ({
|
||||
|
@ -30,11 +26,12 @@ const select = (state) => ({
|
|||
modal: selectCurrentModal(state),
|
||||
isLoading: selectLoadingCurrentUri(state),
|
||||
readyToPlay: selectCurrentUriFileReadyToPlay(state),
|
||||
isDownloading: selectDownloadingCurrentUri(state),
|
||||
isDownloading: <selectDownloadingCurre></selectDownloadingCurre>ntUri(state),
|
||||
})
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
loadVideo: () => dispatch(doLoadVideo()),
|
||||
play: () => dispatch(doPlayVideo()),
|
||||
watchVideo: (elem) => dispatch(doWatchVideo()),
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
})
|
||||
|
|
|
@ -8,6 +8,7 @@ const defaultState = {
|
|||
drawerOpen: sessionStorage.getItem('drawerOpen') || true,
|
||||
upgradeSkipped: sessionStorage.getItem('upgradeSkipped'),
|
||||
daemonReady: false,
|
||||
platform: window.navigator.platform,
|
||||
}
|
||||
|
||||
reducers[types.NAVIGATE] = function(state, action) {
|
||||
|
|
|
@ -214,12 +214,17 @@ reducers[types.DOWNLOADING_STARTED] = function(state, action) {
|
|||
} = action.data
|
||||
const newDownloading = Object.assign({}, state.downloading)
|
||||
const newByUri = Object.assign({}, newDownloading.byUri)
|
||||
const newLoading = Object.assign({}, state.loading)
|
||||
const newLoadingByUri = Object.assign({}, newLoading.byUri)
|
||||
|
||||
newByUri[uri] = true
|
||||
newDownloading.byUri = newByUri
|
||||
delete newLoadingByUri[uri]
|
||||
newLoading.byUri = newLoadingByUri
|
||||
|
||||
return Object.assign({}, state, {
|
||||
downloading: newDownloading,
|
||||
loading: newLoading,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,23 @@ export const selectLoadingByUri = createSelector(
|
|||
export const selectLoadingCurrentUri = createSelector(
|
||||
selectLoadingByUri,
|
||||
selectCurrentUri,
|
||||
(byUri, uri) => byUri[uri]
|
||||
(byUri, uri) => !!byUri[uri]
|
||||
)
|
||||
|
||||
export const selectDownloading = createSelector(
|
||||
_selectState,
|
||||
(state) => state.downloading || {}
|
||||
)
|
||||
|
||||
export const selectDownloadingByUri = createSelector(
|
||||
selectDownloading,
|
||||
(downloading) => downloading.byUri || {}
|
||||
)
|
||||
|
||||
export const selectDownloadingCurrentUri = createSelector(
|
||||
selectCurrentUri,
|
||||
selectDownloadingByUri,
|
||||
(uri, byUri) => byUri[uri]
|
||||
)
|
||||
|
||||
export const shouldFetchPublishedContent = createSelector(
|
||||
|
|
Loading…
Reference in a new issue