|
|
@ -105,7 +105,7 @@ const VideoPlay = ({ dispatch, actions, |
|
|
|
const [showTime_, setShowTime] = useState('') |
|
|
|
const [showTimeSelect, setShowTimeSelect] = useState(false) |
|
|
|
|
|
|
|
|
|
|
|
const [playNumber, setPlayNumber] = useState(0) |
|
|
|
|
|
|
|
const [hideFullScreenBut, setHideFullScreenBut] = useState(false) |
|
|
|
|
|
|
@ -124,6 +124,8 @@ const VideoPlay = ({ dispatch, actions, |
|
|
|
const jessibucas = useRef(null) |
|
|
|
const flvPlayer = useRef() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
setRoll(false) |
|
|
|
}, [resolution]); |
|
|
@ -133,7 +135,7 @@ const VideoPlay = ({ dispatch, actions, |
|
|
|
if (disappear || !videoMask) { |
|
|
|
let duration = moment.duration(videoAfter?.diff(videoFront))._data.milliseconds; |
|
|
|
setTimeout(() => { |
|
|
|
if (disappear || duration > 2000) { |
|
|
|
if (disappear || duration > 6000) { |
|
|
|
setVideoMask(true) |
|
|
|
dispatch(openness.getErrorCode(videoObj.videoToken ? { status: numbers, platform: videoObj.type, token: videoObj.videoToken } : { status: numbers, platform: videoObj.type })).then((res) => { |
|
|
|
if (res.payload.data) { |
|
|
@ -152,7 +154,7 @@ const VideoPlay = ({ dispatch, actions, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}, duration > 2000 ? 0 : 2000 - duration) |
|
|
|
}, duration > 6000 ? 0 : 6000 - duration) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -324,7 +326,9 @@ const VideoPlay = ({ dispatch, actions, |
|
|
|
}) |
|
|
|
} |
|
|
|
if (yingshiPlayer.current && videoObj.type == 'yingshi') { |
|
|
|
yingshiPlayer.current.stop() |
|
|
|
yingshiPlayer.current.stop().then(() => { |
|
|
|
yingshiPlayer.current.destroy() |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, []) |
|
|
@ -458,27 +462,34 @@ const VideoPlay = ({ dispatch, actions, |
|
|
|
videoFront = new moment(); //验证前时间 |
|
|
|
|
|
|
|
// setTimeout(() => { |
|
|
|
const player = new EZUIKit.EZUIKitPlayer({ |
|
|
|
id: containerId, // 视频容器ID |
|
|
|
accessToken: videoObj?.yingshiToken, |
|
|
|
url: videoObj.playUrlSd, |
|
|
|
width: setupSize('width'), |
|
|
|
height: setupSize('height'), |
|
|
|
handleSuccess: (e) => { //播放成功 |
|
|
|
setRoll(true) |
|
|
|
setVideoMask(false) |
|
|
|
playState.current = true |
|
|
|
videoAfter = new moment(); //验证后时间 |
|
|
|
}, |
|
|
|
handleError: (e) => { //播放失败 |
|
|
|
console.log(e, '播放失败'); |
|
|
|
const player = new EZUIKit.EZUIKitPlayer({ |
|
|
|
id: containerId, // 视频容器ID |
|
|
|
accessToken: videoObj?.yingshiToken, |
|
|
|
url: videoObj.playUrlSd, |
|
|
|
width: setupSize('width'), |
|
|
|
height: setupSize('height'), |
|
|
|
handleSuccess: (e) => { //播放成功 |
|
|
|
setRoll(true) |
|
|
|
setVideoMask(false) |
|
|
|
playState.current = true |
|
|
|
videoAfter = new moment(); //验证后时间 |
|
|
|
}, |
|
|
|
handleError: (e) => { //播放失败 |
|
|
|
console.log(e, '播放失败'); |
|
|
|
if (playNumber > 4) { |
|
|
|
setNumbers(e.retcode) |
|
|
|
videoAfter = new moment(); //验证后时间 |
|
|
|
setDisappear(true) |
|
|
|
}, |
|
|
|
}) |
|
|
|
setPlayer(player) |
|
|
|
yingshiPlayer.current = player |
|
|
|
} else { |
|
|
|
setPlayNumber(playNumber + 1) |
|
|
|
yingshiPlayer.current.stop().then(() => { |
|
|
|
yingshiPlayer.current.play({ url: videoObj.playUrlSd }) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
}) |
|
|
|
setPlayer(player) |
|
|
|
yingshiPlayer.current = player |
|
|
|
// }, 0) |
|
|
|
|
|
|
|
} |
|
|
@ -552,10 +563,10 @@ const VideoPlay = ({ dispatch, actions, |
|
|
|
} |
|
|
|
} else { |
|
|
|
setTimeout(() => { |
|
|
|
if (videoObj.type == 'yingshi' && player?.pluginStatus) { |
|
|
|
player.reSize(videoWidth, videoHeight) |
|
|
|
} |
|
|
|
}) |
|
|
|
if (videoObj.type == 'yingshi' && player?.pluginStatus) { |
|
|
|
player.reSize(videoWidth, videoHeight) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
setSize({ parentWidth: containerWidth, parentHeight: containerHeight, width: videoWidth, height: videoHeight }) |
|
|
|
return data == 'width' ? videoWidth : data == 'height' ? videoHeight : '' |
|
|
|