mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 14:16:39 +01:00
Revert Video rewrite because still doesn't work in Mobile Safari
Works in simulator but not the real iPhone
This commit is contained in:
parent
5c162d211f
commit
ca18ea138a
2 changed files with 21 additions and 29 deletions
|
@ -29,7 +29,6 @@ import visibilityIconsMap from '../utils/visibility-icons-map';
|
|||
import Avatar from './avatar';
|
||||
import Icon from './icon';
|
||||
import RelativeTime from './relative-time';
|
||||
import Video from './video';
|
||||
|
||||
function fetchAccount(id) {
|
||||
return masto.v1.accounts.fetch(id);
|
||||
|
@ -796,17 +795,27 @@ function Media({ media, showOriginal, autoAnimate, onClick = () => {} }) {
|
|||
}}
|
||||
>
|
||||
{showOriginal || autoAnimate ? (
|
||||
<Video
|
||||
src={url}
|
||||
poster={previewUrl}
|
||||
width={width}
|
||||
height={height}
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
}}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
<video
|
||||
src="${url}"
|
||||
poster="${previewUrl}"
|
||||
width="${width}"
|
||||
height="${height}"
|
||||
preload="auto"
|
||||
autoplay
|
||||
muted={isGIF}
|
||||
controls={!isGIF}
|
||||
muted="${isGIF}"
|
||||
${isGIF ? '' : 'controls'}
|
||||
playsinline
|
||||
loop={loopable}
|
||||
loop="${loopable}"
|
||||
></video>
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
) : isGIF ? (
|
||||
<video
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
// Video component but allow muted attribute to be set
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
function Video({ muted, autoplay, ...props }) {
|
||||
const videoRef = useRef();
|
||||
useEffect(() => {
|
||||
if (videoRef.current) {
|
||||
videoRef.current.setAttribute('muted', muted);
|
||||
videoRef.current.setAttribute('autoplay', autoplay);
|
||||
videoRef.current.play();
|
||||
}
|
||||
}, [muted]);
|
||||
|
||||
return <video ref={videoRef} {...props} />;
|
||||
}
|
||||
|
||||
export default Video;
|
Loading…
Reference in a new issue