Playing videos actually working now
This commit is contained in:
parent
356393330a
commit
925586f6b1
3 changed files with 20 additions and 16 deletions
|
@ -59,7 +59,7 @@ export function doFetchCurrentUriFileInfo() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
lbry.file_list({ outpoint }).then(([fileInfo]) => {
|
lbry.file_list({ outpoint: outpoint, full_status: true }).then(([fileInfo]) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.FETCH_FILE_INFO_COMPLETED,
|
type: types.FETCH_FILE_INFO_COMPLETED,
|
||||||
data: {
|
data: {
|
||||||
|
@ -274,17 +274,22 @@ export function doWatchVideo() {
|
||||||
const costInfo = selectCurrentUriCostInfo(state)
|
const costInfo = selectCurrentUriCostInfo(state)
|
||||||
const { cost } = costInfo
|
const { cost } = costInfo
|
||||||
|
|
||||||
// TODO does > 0 mean the file is downloaded? We don't have the total_bytes
|
// NOTE: we have to check written bytes because a file may be "completed"
|
||||||
if (fileInfo.written_bytes > 0) {
|
// but then deleted on the file system. In which case we are going to need
|
||||||
dispatch(doPlayVideo(uri))
|
// to dispatch a load event again to redownload it
|
||||||
} else {
|
if (fileInfo.completed && fileInfo.written_bytes > 0) {
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
|
||||||
if (cost > balance) {
|
if (cost > balance) {
|
||||||
dispatch(doOpenModal('notEnoughCredits'))
|
dispatch(doOpenModal('notEnoughCredits'))
|
||||||
} else if (cost <= 0.01) {
|
}
|
||||||
|
else if (cost <= 0.01) {
|
||||||
dispatch(doLoadVideo())
|
dispatch(doLoadVideo())
|
||||||
} else {
|
} else {
|
||||||
dispatch(doOpenModal('affirmPurchase'))
|
dispatch(doOpenModal('affirmPurchase'))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return Promise.resolve()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,11 @@ const select = (state) => ({
|
||||||
modal: selectCurrentModal(state),
|
modal: selectCurrentModal(state),
|
||||||
isLoading: selectLoadingCurrentUri(state),
|
isLoading: selectLoadingCurrentUri(state),
|
||||||
readyToPlay: selectCurrentUriFileReadyToPlay(state),
|
readyToPlay: selectCurrentUriFileReadyToPlay(state),
|
||||||
isDownloading: <selectDownloadingCurre></selectDownloadingCurre>ntUri(state),
|
isDownloading: selectDownloadingCurrentUri(state),
|
||||||
})
|
})
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
loadVideo: () => dispatch(doLoadVideo()),
|
play: () => dispatch(doLoadVideo()),
|
||||||
play: () => dispatch(doPlayVideo()),
|
|
||||||
watchVideo: (elem) => dispatch(doWatchVideo()),
|
watchVideo: (elem) => dispatch(doWatchVideo()),
|
||||||
closeModal: () => dispatch(doCloseModal()),
|
closeModal: () => dispatch(doCloseModal()),
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
import lbry from 'lbry.js';
|
import lbry from 'lbry.js';
|
||||||
import lighthouse from 'lighthouse.js';
|
import lighthouse from 'lighthouse.js';
|
||||||
import lbryuri from 'lbryuri.js';
|
import lbryuri from 'lbryuri.js';
|
||||||
import Video from 'page/video'
|
import Video from 'component/video'
|
||||||
import {
|
import {
|
||||||
TruncatedText,
|
TruncatedText,
|
||||||
Thumbnail,
|
Thumbnail,
|
||||||
|
|
Loading…
Reference in a new issue