Merge pull request #2339 from lbryio/streaming

don't call file_list on web
This commit is contained in:
Shawn K 2019-03-15 13:59:47 -05:00 committed by GitHub
commit 9d97214c4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 6 deletions

View file

@ -59,7 +59,7 @@
"hast-util-sanitize": "^1.1.2",
"keytar": "^4.3.0",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#f140db38dd73cead9e87549340fa9434da62ba8a",
"lbry-redux": "lbryio/lbry-redux#2a7e05940f892f104428eeb37bd1f178da811a09",
"lbryinc": "lbryio/lbryinc#351d0a08806b0f770b50066b61a806171f6424d4",
"localforage": "^1.7.1",
"mammoth": "^1.4.6",

View file

@ -209,7 +209,7 @@ class FileViewer extends React.PureComponent<Props> {
isLoading,
isDownloading,
playingUri,
fileInfo,
fileInfo = {},
contentType,
changeVolume,
volume,
@ -223,9 +223,17 @@ class FileViewer extends React.PureComponent<Props> {
} = this.props;
const isPlaying = playingUri === uri;
/* eslint-disable no-redeclare */
// @if TARGET='app'
const isReadyToPlay = fileInfo && fileInfo.download_path && fileInfo.written_bytes > 0;
const shouldObscureNsfw = obscureNsfw && metadata && metadata.nsfw;
// @endif
// @if TARGET='web'
// try to play immediately on web, we don't need to call file_list since we are streaming from reflector
const isReadyToPlay = isPlaying;
// @endif
/* eslint-enable */
const shouldObscureNsfw = obscureNsfw && metadata && metadata.nsfw;
let loadStatusMessage = '';
if (fileInfo && fileInfo.completed && (!fileInfo.download_path || !fileInfo.written_bytes)) {

View file

@ -79,8 +79,10 @@ class FilePage extends React.Component<Props> {
fetchViewCount(claim.claim_id);
}
// always refresh file info when entering file page
// always refresh file info when entering file page to see if we have the file
// @if TARGET='app'
fetchFileInfo(uri);
// @endif
// See https://github.com/lbryio/lbry-desktop/pull/1563 for discussion
fetchCostInfo(uri);
@ -89,9 +91,11 @@ class FilePage extends React.Component<Props> {
componentWillReceiveProps(nextProps: Props) {
const { fetchFileInfo, uri, setViewed } = this.props;
// @if TARGET='app'
if (nextProps.fileInfo === undefined) {
fetchFileInfo(uri);
}
// @endif
if (uri !== nextProps.uri) {
setViewed(nextProps.uri);

View file

@ -342,7 +342,9 @@ export function doFetchClaimsByChannel(
export function doPlayUri(uri) {
return dispatch => {
dispatch(doSetPlayingUri(uri));
// @if TARGET='app'
dispatch(doPurchaseUri(uri));
// @endif
};
}

View file

@ -5972,9 +5972,9 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
tar-stream "^1.6.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#f140db38dd73cead9e87549340fa9434da62ba8a:
lbry-redux@lbryio/lbry-redux#c2c85a49674662724c943c83afb6141bb41019b7:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/f140db38dd73cead9e87549340fa9434da62ba8a"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/c2c85a49674662724c943c83afb6141bb41019b7"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"