diff --git a/src/components/views/messages/MVideoBody.tsx b/src/components/views/messages/MVideoBody.tsx index 77c7ebacdad..25b2d6ecbd1 100644 --- a/src/components/views/messages/MVideoBody.tsx +++ b/src/components/views/messages/MVideoBody.tsx @@ -236,6 +236,8 @@ export default class MVideoBody extends React.PureComponent const contentUrl = this.getContentUrl(); const thumbUrl = this.getThumbUrl(); + const loop = Boolean(content.info?.["fi.mau.loop"]); + const controls = !content.info?.["fi.mau.hide_controls"]; let height = null; let width = null; let poster = null; @@ -252,6 +254,15 @@ export default class MVideoBody extends React.PureComponent preload = "none"; } } + let onMouseOver; + let onMouseOut; + if (!autoplay && !controls) { + onMouseOver = event => (event.target as HTMLVideoElement).play(); + onMouseOut = event => { + (event.target as HTMLVideoElement).pause(); + (event.target as HTMLVideoElement).currentTime = 0; + }; + } return (