Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
4b69ff95
Commit
4b69ff95
authored
May 06, 2024
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 视频回放增加进度条
parent
ab211a80
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
30 deletions
+81
-30
缺省页.png
packages/base-components/VmsVideo/src/assets/缺省页.png
+0
-0
responsiveCanvas.js
...ents/VmsVideo/src/recVideo/TimeSlider/responsiveCanvas.js
+1
-1
index.js
packages/base-components/VmsVideo/src/recVideo/index.js
+63
-29
index.less
packages/base-components/VmsVideo/src/recVideo/index.less
+17
-0
No files found.
packages/base-components/VmsVideo/src/assets/缺省页.png
0 → 100644
View file @
4b69ff95
44.1 KB
packages/base-components/VmsVideo/src/recVideo/TimeSlider/responsiveCanvas.js
View file @
4b69ff95
...
...
@@ -62,7 +62,7 @@ export default class RvResponsiveCanvas extends Component {
ref
=
{
this
.
setRef
}
width
=
{
width
*
scale
}
height
=
{
height
*
scale
}
style
=
{{
...
style
,
width
,
height
,
minWidth
:
'952px'
}}
style
=
{{
...
style
,
width
,
height
}}
/
>
);
}
...
...
packages/base-components/VmsVideo/src/recVideo/index.js
View file @
4b69ff95
import
{
message
,
ConfigProvider
}
from
'antd'
;
import
{
message
,
ConfigProvider
,
Progress
}
from
'antd'
;
import
{
useEffect
,
useState
,
useContext
,
useRef
,
useImperativeHandle
}
from
'react'
;
import
TestVideo
from
'../index'
;
import
classNames
from
'classnames'
;
import
Empty
from
'@wisdom-components/empty'
;
import
empty_icon
from
'../assets/缺省页.png'
;
import
{
videoPlayback
,
newPlayback
}
from
'../apis'
;
import
'./index.less'
;
import
moment
from
'moment'
;
...
...
@@ -21,11 +22,29 @@ const RecVideo = (props, ref) => {
const
[
minTimestamp
,
setMinTimestamp
]
=
useState
(
null
);
//时间轴最小时间
const
[
maxTimestamp
,
setMaxTimestamp
]
=
useState
(
null
);
//时间轴最大时间
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
[
percent
,
setPercent
]
=
useState
(
0
);
const
timeRef
=
useRef
(
null
);
useEffect
(()
=>
{
changeReplayCfg
();
},
[
props
.
VideoInfo
]);
useEffect
(()
=>
{
let
current
=
percent
;
if
(
loading
)
timeRef
.
current
=
setInterval
(()
=>
{
current
=
current
+
1
;
setPercent
(
current
>
99
?
99
:
current
);
},
40
);
return
()
=>
{
if
(
timeRef
.
current
)
{
clearInterval
(
timeRef
.
current
);
timeRef
.
current
=
null
;
setPercent
(
0
);
}
}
},
[
loading
]);
useImperativeHandle
(
ref
,
()
=>
{
// changeVal 就是暴露给父组件的方法, newVal是父组件传递的参数
return
jessibuca
.
current
;
// _video&& _video.current&&_video.current.jessibuca
...
...
@@ -43,7 +62,8 @@ const RecVideo = (props, ref) => {
force
:
1
,
startTime
:
formattedTime
,
endTime
:
edDates
,
'site-code'
:
window
?.
globalConfig
?.
userInfo
?.
LocalSite
||
window
?.
globalConfig
?.
userInfo
?.
site
||
''
,
'site-code'
:
window
?.
globalConfig
?.
userInfo
?.
LocalSite
||
window
?.
globalConfig
?.
userInfo
?.
site
||
''
,
};
rePaly
(
params
);
}
...
...
@@ -62,7 +82,8 @@ const RecVideo = (props, ref) => {
force
:
1
,
startTime
:
stTimes
,
endTime
:
edTimes
,
'site-code'
:
window
?.
globalConfig
?.
userInfo
?.
LocalSite
||
window
?.
globalConfig
?.
userInfo
?.
site
||
''
,
'site-code'
:
window
?.
globalConfig
?.
userInfo
?.
LocalSite
||
window
?.
globalConfig
?.
userInfo
?.
site
||
''
,
};
setHoursRuler
(
hoursPerRuler
);
setMinTimestamp
(
moment
(
stTimes
).
valueOf
());
...
...
@@ -72,34 +93,36 @@ const RecVideo = (props, ref) => {
const
getVideoPlBack
=
(
param
)
=>
{
setLoading
(
true
);
videoPlayback
(
param
).
then
((
res
)
=>
{
setLoading
(
false
);
if
(
res
.
code
===
200
)
{
setPeridos
(
res
.
data
.
peridos
.
map
((
times
,
i
)
=>
{
let
beginTime
=
moment
(
times
.
StartTime
.
replaceAll
(
'T'
,
' '
).
replaceAll
(
'Z'
,
' '
));
let
endTime
=
moment
(
times
.
EndTime
.
replaceAll
(
'T'
,
' '
).
replaceAll
(
'Z'
,
' '
));
return
{
...
times
,
idx
:
i
,
beginTime
:
beginTime
.
valueOf
(),
endTime
:
endTime
.
valueOf
(),
style
:
{
background
:
'#637DEC'
},
};
}),
);
setShowId
(
res
.
data
.
url
);
}
else
{
message
.
warn
(
res
.
msg
);
setShowId
(
null
);
}
});
videoPlayback
(
param
)
.
then
((
res
)
=>
{
setLoading
(
false
);
if
(
res
.
code
===
200
)
{
setPeridos
(
res
.
data
.
peridos
.
map
((
times
,
i
)
=>
{
let
beginTime
=
moment
(
times
.
StartTime
.
replaceAll
(
'T'
,
' '
).
replaceAll
(
'Z'
,
' '
));
let
endTime
=
moment
(
times
.
EndTime
.
replaceAll
(
'T'
,
' '
).
replaceAll
(
'Z'
,
' '
));
return
{
...
times
,
idx
:
i
,
beginTime
:
beginTime
.
valueOf
(),
endTime
:
endTime
.
valueOf
(),
style
:
{
background
:
'#637DEC'
},
};
}),
);
setShowId
(
res
.
data
.
url
);
}
else
{
message
.
warn
(
res
.
msg
);
setShowId
(
null
);
}
})
.
catch
((
error
)
=>
{
setLoading
(
false
);
});
};
const
rePaly
=
(
params
)
=>
{
setLoading
(
true
);
newPlayback
(
params
).
then
((
res
)
=>
{
setLoading
(
false
);
if
(
res
.
code
===
200
)
{
setShowId
(
res
.
data
);
}
else
{
...
...
@@ -117,7 +140,14 @@ const RecVideo = (props, ref) => {
return
(
<
div
className
=
{
classNames
(
prefixCls
)}
>
{
showId
?
(
{
loading
?
(
<>
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-load`
)}
>
<
Progress
className
=
{
classNames
(
`
${
prefixCls
}
-progress`
)}
strokeWidth
=
{
14
}
percent
=
{
percent
}
/
>
<
span
>
视频回放信息获取中,请稍后
...
<
/span
>
<
/div
>
<
/
>
)
:
showId
?
(
<>
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-video`
)}
>
{
showId
&&
(
...
...
@@ -152,7 +182,11 @@ const RecVideo = (props, ref) => {
<
/
>
)
:
(
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-empty`
)}
>
{
!
loading
&&
<
Empty
theme
=
{
'dark'
}
description
=
{
''
}
/>
}
<
Empty
image
=
{
empty_icon
}
theme
=
{
'dark'
}
description
=
{
'咦~暂时没有查询到视频回放信息呢~'
}
/
>
<
/div
>
)}
<
/div
>
...
...
packages/base-components/VmsVideo/src/recVideo/index.less
View file @
4b69ff95
...
...
@@ -9,6 +9,23 @@
height: 100%;
width: 100%;
&-load {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow: hidden;
}
&-progress {
width: 100%;
overflow: hidden;
width: 50%;
margin-bottom: 10px;
}
&-video {
flex: 1;
width: 100%;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment