Video player #14

Merged
innocuous-symmetry merged 10 commits from video-player into master 2022-02-08 17:36:39 +00:00
3 changed files with 10 additions and 4 deletions
Showing only changes of commit 8aa9ef9ae7 - Show all commits

View File

@@ -93,6 +93,10 @@ img, video {
color:rgb(228, 180, 226);
}
/* Video player */
/* Handles comment styles on toggle */
.comments-visible {

View File

@@ -1,5 +1,4 @@
import React, { useState, useEffect } from "react";
// import { useDispatch } from "react-redux";
import Discussion from "../discussion/Discussion";
import VideoPlayer from "../video/VideoPlayer";
import './Post.css';
@@ -71,7 +70,7 @@ export default function Post({data, key}) {
if (data.crosspost_parent_list[0].is_video) {
return (
<>
<video controls src={data.crosspost_parent_list[0].media.reddit_video.fallback_url}>This video is not supported by your browser.</video>
<VideoPlayer data={data} src={data.crosspost_parent_list[0].url} />
<p className="crosspost-from">Crosspost from {data.crosspost_parent_list[0].subreddit_name_prefixed}</p>
</>
);

View File

@@ -1,10 +1,13 @@
import { useState, useEffect, useRef } from 'react';
export default function VideoPlayer({data}) {
export default function VideoPlayer({data, src}) {
const vid = useRef();
const aud = useRef();
let url = data.url ? data.url : null;
const crossPostSrc = src;
let url = crossPostSrc ? crossPostSrc :
(data.url ? data.url : null);
const [playing, setPlaying] = useState(false);
useEffect(() => {