Commit 2e2438b3 authored by 李纪文's avatar 李纪文

feat: hkH5player支持wss视频回放

parent 9e255750
...@@ -226,7 +226,8 @@ const HKh5player = (props, ref) => { ...@@ -226,7 +226,8 @@ const HKh5player = (props, ref) => {
// 视频开始播放 // 视频开始播放
const playbackStart = (times) => { const playbackStart = (times) => {
const index = 0; const index = 0;
const playURL = `ws://${window?.location?.host || ''}/openUrl/${videoUrl.current}`; const defaultUrl = `ws://${window?.location?.host || ''}`;
const playURL = `${getVideoUrl() || defaultUrl}/openUrl/${videoUrl.current}`;
const beginTime = times.beginTime.replaceAll(' ', 'T') + 'Z'; const beginTime = times.beginTime.replaceAll(' ', 'T') + 'Z';
const endTime = times.endTime.replaceAll(' ', 'T') + 'Z'; const endTime = times.endTime.replaceAll(' ', 'T') + 'Z';
setSping(true); setSping(true);
...@@ -557,4 +558,11 @@ const HKh5player = (props, ref) => { ...@@ -557,4 +558,11 @@ const HKh5player = (props, ref) => {
); );
}; };
export const getVideoUrl = () => {
const protocol = window.location.protocol;
const port = window.location.port ? '' : ':443';
const address = protocol === "https:" ? `${window.location.origin.replace(protocol, 'wss:')}${port}` : window.location.origin.replace(protocol, 'ws:');
return `${address}`;
};
export default HKh5player; export default HKh5player;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment