From dd5c1ca7e8fe0ccc17c30bd44ac483c3af2b9c05 Mon Sep 17 00:00:00 2001 From: jessop Date: Wed, 28 Aug 2019 19:33:38 -0400 Subject: [PATCH] does not autoplay nonfree --- src/ui/component/fileViewerInitiator/index.js | 1 + src/ui/component/fileViewerInitiator/view.jsx | 6 +++-- static/locales/en.json | 22 +------------------ 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/ui/component/fileViewerInitiator/index.js b/src/ui/component/fileViewerInitiator/index.js index 979e39ebb..e3d235382 100644 --- a/src/ui/component/fileViewerInitiator/index.js +++ b/src/ui/component/fileViewerInitiator/index.js @@ -24,6 +24,7 @@ const select = (state, props) => ({ isStreamable: makeSelectUriIsStreamable(props.uri)(state), autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state), hasCostInfo: Boolean(makeSelectCostInfoForUri(props.uri)(state)), + costInfo: makeSelectCostInfoForUri(props.uri)(state), }); const perform = dispatch => ({ diff --git a/src/ui/component/fileViewerInitiator/view.jsx b/src/ui/component/fileViewerInitiator/view.jsx index 218c244d3..508aa21cd 100644 --- a/src/ui/component/fileViewerInitiator/view.jsx +++ b/src/ui/component/fileViewerInitiator/view.jsx @@ -23,6 +23,7 @@ type Props = { thumbnail?: string, autoplay: boolean, hasCostInfo: boolean, + costInfo: any, }; export default function FileViewer(props: Props) { @@ -38,6 +39,7 @@ export default function FileViewer(props: Props) { autoplay, isStreamable, hasCostInfo, + costInfo, } = props; const isPlayable = ['audio', 'video'].indexOf(mediaType) !== -1; @@ -77,10 +79,10 @@ export default function FileViewer(props: Props) { useEffect(() => { const videoOnPage = document.querySelector('video'); - if (autoplay && !videoOnPage && isStreamable && hasCostInfo) { + if (autoplay && !videoOnPage && isStreamable && hasCostInfo && costInfo.cost === 0) { viewFile(); } - }, [autoplay, viewFile, isStreamable, hasCostInfo]); + }, [autoplay, viewFile, isStreamable, hasCostInfo, costInfo]); return (