From 24493767f9516edaee250f835d34f447efde0d92 Mon Sep 17 00:00:00 2001 From: Mikayla Dobson Date: Mon, 7 Feb 2022 20:08:52 -0600 Subject: [PATCH] documentation --- src/features/posts/Post.css | 6 ++++++ src/features/video/VideoPlayer.js | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/features/posts/Post.css b/src/features/posts/Post.css index d2fe0f8..4c74da3 100644 --- a/src/features/posts/Post.css +++ b/src/features/posts/Post.css @@ -95,7 +95,13 @@ img, video { /* Video player */ +.video-player { + display: inline-flex; +} +.post-audio, .post-video { + position: absolute; +} /* Handles comment styles on toggle */ diff --git a/src/features/video/VideoPlayer.js b/src/features/video/VideoPlayer.js index 5af531e..6a96035 100644 --- a/src/features/video/VideoPlayer.js +++ b/src/features/video/VideoPlayer.js @@ -2,16 +2,17 @@ import { useState, useEffect, useRef } from 'react'; export default function VideoPlayer({data, src}) { const vid = useRef(); - const aud = useRef(); + const aud = useRef(); // identifies location of video/audio in DOM + + const [playing, setPlaying] = useState(false); // handles play/pause logic const crossPostSrc = src; - let url = crossPostSrc ? crossPostSrc : - (data.url ? data.url : null); - const [playing, setPlaying] = useState(false); + let url = crossPostSrc ? crossPostSrc : // sets video source according to applicable + (data.url ? data.url : null); // location within reddit response - useEffect(() => { - if (playing) { + useEffect(() => { // synchronizes play/pause between two components + if (playing) { // according to section of state vid.current.play(); vid.current.currentTime = aud.current.currentTime; } else if (!playing) {