From 00e03ff6bef40bb128bd4006996b6ca027720a87 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 13 Aug 2019 23:09:25 -0400 Subject: [PATCH] fix: only autoplay streamable files --- src/ui/component/fileViewerInitiator/view.jsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ui/component/fileViewerInitiator/view.jsx b/src/ui/component/fileViewerInitiator/view.jsx index 7572b6f77..a8e5142a9 100644 --- a/src/ui/component/fileViewerInitiator/view.jsx +++ b/src/ui/component/fileViewerInitiator/view.jsx @@ -25,7 +25,18 @@ type Props = { }; export default function FileViewer(props: Props) { - const { play, mediaType, isPlaying, fileInfo, uri, obscurePreview, insufficientCredits, thumbnail, autoplay } = props; + const { + play, + mediaType, + isPlaying, + fileInfo, + uri, + obscurePreview, + insufficientCredits, + thumbnail, + autoplay, + isStreamable, + } = props; const isPlayable = ['audio', 'video'].indexOf(mediaType) !== -1; const fileStatus = fileInfo && fileInfo.status; @@ -64,10 +75,10 @@ export default function FileViewer(props: Props) { useEffect(() => { const videoOnPage = document.querySelector('video'); - if (autoplay && !videoOnPage) { + if (autoplay && !videoOnPage && isStreamable) { viewFile(); } - }, [autoplay, viewFile]); + }, [autoplay, viewFile, isStreamable]); return (