Fix unavailable content take 2

This commit is contained in:
Thomas Zarebczan 2019-03-19 02:32:53 -04:00
parent 2f2f37199c
commit 078c001731
2 changed files with 16 additions and 18 deletions

View file

@ -107,14 +107,14 @@ class FileRender extends React.PureComponent<Props> {
application: !source.url ? null : (
<webview
ref={element => this.processSandboxRef(element)}
title=''
sandbox='allow-scripts allow-forms allow-pointer-lock'
title=""
sandbox="allow-scripts allow-forms allow-pointer-lock"
src={source.url}
autosize='on'
autosize="on"
style={{ border: 0, width: '100%', height: '100%' }}
useragent='Mozilla/5.0 AppleWebKit/537 Chrome/60 Safari/537'
enableremotemodule='false'
webpreferences='sandbox=true,contextIsolation=true,webviewTag=false,enableRemoteModule=false,devTools=false'
useragent="Mozilla/5.0 AppleWebKit/537 Chrome/60 Safari/537"
enableremotemodule="false"
webpreferences="sandbox=true,contextIsolation=true,webviewTag=false,enableRemoteModule=false,devTools=false"
/>
),
video: (
@ -150,7 +150,14 @@ class FileRender extends React.PureComponent<Props> {
if (!viewer && readableFiles.includes(mediaType)) {
viewer = <DocumentViewer source={{ stream, fileType, contentType }} theme={currentTheme} />;
}
// temp workaround
if (claim && claim.value.stream.metadata.fee && claim.value.stream.metadata.fee.amount > 0) {
const paidMessage = __(
'Currently, only free content is available on lbry.tv. Try viewing it in the desktop app.'
);
const paid = <LoadingScreen status={paidMessage} spinner={false} />;
return paid;
}
// Message Error
const unsupportedMessage = __("Sorry, looks like we can't preview this file.");
const unsupported = <LoadingScreen status={unsupportedMessage} spinner={false} />;
@ -160,7 +167,7 @@ class FileRender extends React.PureComponent<Props> {
}
render() {
return <div className='file-render'>{this.renderViewer()}</div>;
return <div className="file-render">{this.renderViewer()}</div>;
}
}

View file

@ -287,17 +287,8 @@ class MediaPlayer extends React.PureComponent<Props, State> {
}
showLoadingScreen(isFileType: boolean, isPlayableType: boolean) {
const { claim, mediaType, contentType } = this.props;
const { mediaType, contentType } = this.props;
const { unplayable, fileSource, hasMetadata } = this.state;
if (claim && claim.value.stream.metadata.fee && claim.value.stream.metadata.fee.amount > 0) {
return {
isLoading: false,
loadingStatus: __(
'Currently, only free content is available on lbry.tv. Try viewing it in the desktop app.'
),
};
}
if (['audio', 'video'].indexOf(mediaType) === -1) {
return {