import React from "react";
import clsx from "clsx";
import ReactPlayer from "react-player";
import { Spinner } from "@gland/react/spin";
import { richClasses as classes } from "../style";
import { icons } from "../icons";
import { editEvent } from "../editEvent";
export function Video(props) {
return props.data.isRemote ? : ;
}
function RemoteVideo(props) {
props = props.props;
const [URL, setURL] = React.useState(null);
React.useEffect(() => {
const getContentAsset = props.context.editor?.remote?.getContentAsset;
if (getContentAsset) {
getContentAsset(props.data, setURL, "Video");
} else {
setURL("");
}
}, [props.data]);
if (URL === null) {
return (
);
}
return ;
}
function VideoContent(props) {
const URL = props.URL;
const { context, data, isSelected, blockKey } = props.props;
const { width, height, align, title, catalog } = data;
let style = {} as any;
if (align === "left" || align === "right") {
style.float = align;
}
return (
{
if (e.detail >= 2) {
openEdit();
}
}
}
style={style}
>
{catalog === "2" ? (
) : (
)}
{context.readOnly ? null :
{"\r"}
}
{title ?
{title}
: null}
{context.readOnly ? null : (
{
event.stopPropagation();
openEdit();
}}
>
)}
);
function openEdit() {
context.event.emit(editEvent.openEditVideo, { key: blockKey, data, type: "block" });
}
}