固定摄像头播放问题
parent
62bcd55408
commit
870923e176
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable react-dom/no-missing-iframe-sandbox -- 该视频播放页添加 sandbox 后无法正常播放,需要保留完整的运行权限。 */
|
||||||
import VideoCameraOutlined from "@ant-design/icons/VideoCameraOutlined";
|
import VideoCameraOutlined from "@ant-design/icons/VideoCameraOutlined";
|
||||||
import { Button, Modal, Spin } from "antd";
|
import { Button, Modal, Spin } from "antd";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
@ -11,6 +12,8 @@ const PLAY_SOURCE_TYPE = {
|
||||||
DATABASE: "database",
|
DATABASE: "database",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isHtmlPlayAddress = address => address?.toLowerCase().includes(".html");
|
||||||
|
|
||||||
const VideoPlayModal = (props) => {
|
const VideoPlayModal = (props) => {
|
||||||
const {
|
const {
|
||||||
onClose,
|
onClose,
|
||||||
|
|
@ -284,7 +287,20 @@ const VideoPlayModal = (props) => {
|
||||||
>
|
>
|
||||||
<div ref={playerContainerRef} style={playerBoxStyle}>
|
<div ref={playerContainerRef} style={playerBoxStyle}>
|
||||||
{playUrl
|
{playUrl
|
||||||
? <Video key={`${playerKey}-${playUrl}`} height="100%" width="100%" source={playUrl} isLive />
|
? isHtmlPlayAddress(playUrl)
|
||||||
|
? (
|
||||||
|
<iframe
|
||||||
|
key={`${playerKey}-${playUrl}`}
|
||||||
|
title={videoName || "视频播放"}
|
||||||
|
src={`${playUrl}&aspect=fullscreen&stretch=yes`}
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
frameBorder="0"
|
||||||
|
allow="autoplay; fullscreen; microphone"
|
||||||
|
allowFullScreen
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
: <Video key={`${playerKey}-${playUrl}`} inline height="100%" width="100%" source={playUrl} isLive aliPlayerProps={{ extraInfo: { crossOrigin: "anonymous" } }} />
|
||||||
: <div style={{ textAlign: "center", maxWidth: 560, padding: "0 24px" }}>暂无视频播放地址</div>}
|
: <div style={{ textAlign: "center", maxWidth: 560, padding: "0 24px" }}>暂无视频播放地址</div>}
|
||||||
</div>
|
</div>
|
||||||
{(warningText || originalPlayUrl) && (
|
{(warningText || originalPlayUrl) && (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue