Skip to content

Commit

Permalink
Merge pull request #2339 from lbryio/streaming
Browse files Browse the repository at this point in the history
don't call file_list on web
  • Loading branch information
skhameneh authored Mar 15, 2019
2 parents 4728365 + cee3047 commit 9d97214
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 10 additions & 2 deletions src/ui/component/fileViewer/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class FileViewer extends React.PureComponent<Props> {
isLoading,
isDownloading,
playingUri,
fileInfo,
fileInfo = {},
contentType,
changeVolume,
volume,
Expand All @@ -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)) {
Expand Down
6 changes: 5 additions & 1 deletion src/ui/page/file/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/ui/redux/actions/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ export function doFetchClaimsByChannel(
export function doPlayUri(uri) {
return dispatch => {
dispatch(doSetPlayingUri(uri));
// @if TARGET='app'
dispatch(doPurchaseUri(uri));
// @endif
};
}

Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9d97214

Please sign in to comment.