UNPKG

panjareh

Version:

Panjareh using aparat and phoenix-video-player to play videos on desktops and tvs.

47 lines (37 loc) 1.19 kB
import React, { useEffect, useState } from "react"; import VideoPlayer from "../../components/VideoPlayer"; import ProductApi from "../../service/api"; import Product from "../../service/product"; import consts from "../../config/playerDefaults"; import { getVideoJsConfig } from "../../mock"; const VideoPlayerOptions = getVideoJsConfig({ imortal: !0 }); console.log("VideoPlayerOptions are : ", VideoPlayerOptions); const PlayerDesktopConfig = (props) => { // todo: get product alias some how. const playerRef = React.useRef(null); const handlePlayerReady = ({ videojs }) => { playerRef.current = videojs; // configSubtitile(videojs); // you can handle player events here videojs.on("waiting", () => { console.log("player is waiting"); }); videojs.on("dispose", () => { console.log("player will dispose"); }); }; return ( <div style={{ display: "flex", justifyContent: "center", alignItems: "center", }} > {VideoPlayerOptions && ( <VideoPlayer options={VideoPlayerOptions} onReady={handlePlayerReady} /> )} </div> ); }; export default PlayerDesktopConfig;