fix: only autoplay streamable files
This commit is contained in:
parent
f51cabc561
commit
00e03ff6be
1 changed files with 14 additions and 3 deletions
|
@ -25,7 +25,18 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function FileViewer(props: 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 isPlayable = ['audio', 'video'].indexOf(mediaType) !== -1;
|
||||||
const fileStatus = fileInfo && fileInfo.status;
|
const fileStatus = fileInfo && fileInfo.status;
|
||||||
|
@ -64,10 +75,10 @@ export default function FileViewer(props: Props) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const videoOnPage = document.querySelector('video');
|
const videoOnPage = document.querySelector('video');
|
||||||
if (autoplay && !videoOnPage) {
|
if (autoplay && !videoOnPage && isStreamable) {
|
||||||
viewFile();
|
viewFile();
|
||||||
}
|
}
|
||||||
}, [autoplay, viewFile]);
|
}, [autoplay, viewFile, isStreamable]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in a new issue