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 (