does not autoplay nonfree

This commit is contained in:
jessop 2019-08-28 19:33:38 -04:00 committed by Sean Yesmunt
parent 457d5c3bc4
commit dd5c1ca7e8
3 changed files with 6 additions and 23 deletions

View file

@ -24,6 +24,7 @@ const select = (state, props) => ({
isStreamable: makeSelectUriIsStreamable(props.uri)(state), isStreamable: makeSelectUriIsStreamable(props.uri)(state),
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state), autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state),
hasCostInfo: Boolean(makeSelectCostInfoForUri(props.uri)(state)), hasCostInfo: Boolean(makeSelectCostInfoForUri(props.uri)(state)),
costInfo: makeSelectCostInfoForUri(props.uri)(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({

View file

@ -23,6 +23,7 @@ type Props = {
thumbnail?: string, thumbnail?: string,
autoplay: boolean, autoplay: boolean,
hasCostInfo: boolean, hasCostInfo: boolean,
costInfo: any,
}; };
export default function FileViewer(props: Props) { export default function FileViewer(props: Props) {
@ -38,6 +39,7 @@ export default function FileViewer(props: Props) {
autoplay, autoplay,
isStreamable, isStreamable,
hasCostInfo, hasCostInfo,
costInfo,
} = props; } = props;
const isPlayable = ['audio', 'video'].indexOf(mediaType) !== -1; const isPlayable = ['audio', 'video'].indexOf(mediaType) !== -1;
@ -77,10 +79,10 @@ export default function FileViewer(props: Props) {
useEffect(() => { useEffect(() => {
const videoOnPage = document.querySelector('video'); const videoOnPage = document.querySelector('video');
if (autoplay && !videoOnPage && isStreamable && hasCostInfo) { if (autoplay && !videoOnPage && isStreamable && hasCostInfo && costInfo.cost === 0) {
viewFile(); viewFile();
} }
}, [autoplay, viewFile, isStreamable, hasCostInfo]); }, [autoplay, viewFile, isStreamable, hasCostInfo, costInfo]);
return ( return (
<div <div

View file

@ -672,25 +672,5 @@
"Hindi": "Hindi", "Hindi": "Hindi",
"Greek": "Greek", "Greek": "Greek",
"Hide": "Hide", "Hide": "Hide",
"Network and Data Settings": "Network and Data Settings", "'contentName' should no longer be used. Use 'streamName' instead": "'contentName' should no longer be used. Use 'streamName' instead"
"Save all viewed content to your downloads directory": "Save all viewed content to your downloads directory",
"Paid content and some file types are saved by default. Changing this setting will not affect previously downloaded content.": "Paid content and some file types are saved by default. Changing this setting will not affect previously downloaded content.",
"Save hosting data to help the LBRY network": "Save hosting data to help the LBRY network",
"If disabled, LBRY will be very sad and you won't be helping improve the network.": "If disabled, LBRY will be very sad and you won't be helping improve the network.",
"Floating video player": "Floating video player",
"Keep content playing in the corner when navigating to a different page.": "Keep content playing in the corner when navigating to a different page.",
"Blocked Channels": "Blocked Channels",
"blocked": "blocked",
"channels": "channels",
"Manage": "Manage",
"Automatic dark mode": "Automatic dark mode",
"Hide wallet balance in header": "Hide wallet balance in header",
"Max Connections": "Max Connections",
"For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.": "For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.",
"This will clear the application cache. Your wallet will not be affected. Currently, followed tags and blocked channels will be cleared.": "This will clear the application cache. Your wallet will not be affected. Currently, followed tags and blocked channels will be cleared.",
"'contentName' should no longer be used. Use 'streamName' instead": "'contentName' should no longer be used. Use 'streamName' instead",
"LBRY Download Complete": "LBRY Download Complete",
"Sorry, we can't preview this file.": "Sorry, we can't preview this file.",
"View File": "View File",
"Close": "Close"
} }