|
|
@ -2,6 +2,8 @@ import React, { useState, useEffect, useRef } from "react"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import screenfull from 'screenfull'; |
|
|
|
import moment from "moment"; |
|
|
|
import request from 'superagent' |
|
|
|
import { VideoServeApi, IotVideoServerRequest } from '$utils' |
|
|
|
import VideoHeader from './voiceHeader' |
|
|
|
import VideoOperation from './videoOperation' |
|
|
|
import './videoPlay.less'; |
|
|
@ -15,7 +17,9 @@ const VideoPlay = ({ |
|
|
|
height, width, containerId = 'myPlayer', |
|
|
|
// playUrl, |
|
|
|
name, |
|
|
|
|
|
|
|
// videoObj, |
|
|
|
|
|
|
|
// videoObj = { |
|
|
|
// type: 'yingshi', |
|
|
|
// audio: false, |
|
|
@ -27,15 +31,19 @@ const VideoPlay = ({ |
|
|
|
// playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live', |
|
|
|
// // replayUrl: 'ezopen://open.ys7.com/G75922040/1.rec', |
|
|
|
// }, |
|
|
|
|
|
|
|
videoObj = { |
|
|
|
type: 'cascade', |
|
|
|
audio: false, |
|
|
|
serialNo: 'G75922040', // 设备序列号 必须 |
|
|
|
topSerialNo: 'G75922040', // 设备顶级序列号 必须 |
|
|
|
playUrlSd: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000003', // 必须 |
|
|
|
serialNo: '34020000001310000001', // 设备序列号 必须 |
|
|
|
topSerialNo: '34020000001110000077', // 设备顶级序列号 必须 |
|
|
|
playUrlSd: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000001', // 必须 |
|
|
|
// playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live', |
|
|
|
// replayUrl: 'ezopen://open.ys7.com/G75922040/1.rec', |
|
|
|
}, |
|
|
|
|
|
|
|
// |
|
|
|
iotVideoServer |
|
|
|
}) => { |
|
|
|
console.log(videoObj); |
|
|
|
const [jessibuca, setjessibuca] = useState(null) |
|
|
@ -211,8 +219,23 @@ const VideoPlay = ({ |
|
|
|
|
|
|
|
const createJessibuca = async () => { |
|
|
|
if (videoObj.type != 'yingshi') { |
|
|
|
try { |
|
|
|
// const inviteRes = await IotVideoServerRequest.get(VideoServeApi.invite, { |
|
|
|
// id: '36011200002002021114', |
|
|
|
// channel: '36011200581314002900' |
|
|
|
// }).then(res => { |
|
|
|
// console.log(res); |
|
|
|
// }, err => { |
|
|
|
// console.log(err); |
|
|
|
// }) |
|
|
|
|
|
|
|
let $container = document.getElementById('container'); |
|
|
|
const inviteRes_ = await request.get(`${iotVideoServer}/api/gb28181/invite?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`) |
|
|
|
} catch (error) { |
|
|
|
console.log(error.response); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let $container = document.getElementById(containerId); |
|
|
|
const jessibuca = new window.Jessibuca({ |
|
|
|
container: $container, |
|
|
|
videoBuffer: 0.2, // 缓存时长 |
|
|
@ -220,18 +243,18 @@ const VideoPlay = ({ |
|
|
|
text: "", |
|
|
|
loadingText: "加载中", |
|
|
|
debug: true, |
|
|
|
showBandwidth: true, // 显示网速 |
|
|
|
showBandwidth: false, // 显示网速 |
|
|
|
operateBtns: { |
|
|
|
fullscreen: true, |
|
|
|
screenshot: true, |
|
|
|
play: true, |
|
|
|
audio: true, |
|
|
|
fullscreen: false, |
|
|
|
screenshot: false, |
|
|
|
play: false, |
|
|
|
audio: false, |
|
|
|
}, |
|
|
|
forceNoOffscreen: false, |
|
|
|
isNotMute: false, |
|
|
|
}); |
|
|
|
setjessibuca(jessibuca) |
|
|
|
play() |
|
|
|
play({ jessibuca }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -240,11 +263,12 @@ const VideoPlay = ({ |
|
|
|
// setIsPlaying(operation == 'play') |
|
|
|
} |
|
|
|
|
|
|
|
const play = () => { |
|
|
|
const play = (params) => { |
|
|
|
if (videoObj.type == 'yingshi') { |
|
|
|
yingshiOperation('play') |
|
|
|
} else if (jessibuca && videoObj.playUrlSd) { |
|
|
|
jessibuca.play(videoObj.playUrlSd); |
|
|
|
} else if ((params.jessibuca || jessibuca) && videoObj.playUrlSd) { |
|
|
|
const jes = params.jessibuca || jessibuca |
|
|
|
jes.play(videoObj.playUrlSd); |
|
|
|
setIsPlaying(true) |
|
|
|
} |
|
|
|
} |
|
|
@ -276,7 +300,7 @@ const VideoPlay = ({ |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
|
<div className="vcmp_videoplay" style={{ height: height || '100%', width: width || '100%' }}> |
|
|
|
<div className="vcmp_videoplay" style={{ height: height || '100%', width: width || '100%', overflow: 'hidden' }}> |
|
|
|
<div id="vcmp_videoplay" style={{ position: 'relative', display: 'flex', height: '100%', width: '100%' }}> |
|
|
|
{/* 顶部信息 */} |
|
|
|
<VideoHeader |
|
|
@ -306,7 +330,8 @@ const VideoPlay = ({ |
|
|
|
wmode="transparent" |
|
|
|
style={{ pointerEvents: 'none' }} |
|
|
|
/> : |
|
|
|
<div id="container" |
|
|
|
<div |
|
|
|
id={containerId} |
|
|
|
style={{ |
|
|
|
height: '100%', width: '100%' |
|
|
|
}}> |
|
|
@ -337,9 +362,11 @@ const VideoPlay = ({ |
|
|
|
} |
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
const { auth } = state; |
|
|
|
const { auth, global } = state; |
|
|
|
console.log(global); |
|
|
|
return { |
|
|
|
user: auth.user, |
|
|
|
iotVideoServer: global.iotVideoServer, |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|