Skip to content

Commit

Permalink
fix(client): removed code causing a JS crash : The play() request [..…
Browse files Browse the repository at this point in the history
….] removed from the document
  • Loading branch information
Will Moss committed Jul 18, 2024
1 parent 98e1274 commit 72ccc0b
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions src/components/VideoCard/index.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
// Dependencies
import { useEffect, useRef } from 'react';
import { useEffect, useRef } from "react";

// Assets
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faFilm } from '@fortawesome/free-solid-svg-icons';
import './index.css';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faFilm } from "@fortawesome/free-solid-svg-icons";
import "./index.css";

const VideoCard = ({
index,
url,
title,
autoplay,
isLoaded,
isMuted,
refForwarder,
}) => {
const VideoCard = ({ index, url, title, isLoaded, isMuted, refForwarder }) => {
const videoRef = useRef(null);

useEffect(() => {
if (autoplay) videoRef.current.play();
}, [autoplay]);

// Toggle play/pause on click
const togglePause = () => {
if (videoRef.current.paused) videoRef.current.play();
Expand All @@ -47,7 +35,7 @@ const VideoCard = ({
<div className="footer-left">
<div className="text">
<div className="ticker">
<FontAwesomeIcon icon={faFilm} style={{ width: '30px' }} />
<FontAwesomeIcon icon={faFilm} style={{ width: "30px" }} />
<span>{title}</span>
</div>
</div>
Expand Down

0 comments on commit 72ccc0b

Please sign in to comment.