Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
蒋秀川
/
miniProject
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit aa48bdd2
authored
Sep 20, 2023
by
Tianqing Liu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 播放增加限制条件
1 parent
8c461dca
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
h5/src/components/vionPlayer/index.vue
h5/src/views/player/vionPlayerDemo.vue
h5/src/components/vionPlayer/index.vue
View file @
aa48bdd
...
...
@@ -38,6 +38,7 @@ export default {
return
{
// eslint-disable-next-line
_jessibuca
:
null
,
playing
:
false
,
player
:
{
height
:
0
,
...
...
@@ -48,6 +49,9 @@ export default {
mounted
()
{
this
.
init
();
},
unmounted
()
{
this
.
destroy
();
},
methods
:{
init
(
params
=
{})
{
const
options
=
Object
.
assign
({
...
...
@@ -115,6 +119,15 @@ export default {
this
.
player
.
height
=
data
.
height
;
});
playerIns
.
on
(
'play'
,
(
flag
)
=>
{
console
.
log
(
'on-play'
,
flag
);
this
.
playing
=
true
;
});
playerIns
.
on
(
'pause'
,
(
flag
)
=>
{
console
.
log
(
'on-pause'
,
flag
);
this
.
playing
=
false
;
});
playerIns
.
on
(
'ptz'
,
(
arrow
)
=>
{
// console.log('ptz', arrow);
this
.
$emit
(
'ptz-control'
,
arrow
);
...
...
@@ -144,19 +157,14 @@ export default {
if
(
this
.
_jessibuca
)
{
this
.
_jessibuca
.
destroy
().
then
(()
=>
{
this
.
_jessibuca
=
null
;
this
.
playing
=
false
;
});
}
},
screenshot2
(
filename
=
''
,
format
=
'png'
,
quality
=
0.92
,
type
=
'base64'
)
{
// TODO: 必须播放状态,才可获取水印
const
originData
=
this
.
_jessibuca
.
screenshot
(
filename
,
format
,
quality
,
type
);
// TODO: 动态获取宽高
return
getWatermarkCanvasImg
(
800
,
480
,
'文安智能'
,
originData
);
},
screenshot
(
filename
=
''
,
format
=
'png'
,
quality
=
0.92
,
type
=
'base64'
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 如果是播放状态
if
(
!
this
.
player
.
height
||
!
this
.
player
.
width
)
{
if
(
!
this
.
player
.
height
||
!
this
.
player
.
width
||
!
this
.
playing
)
{
reject
(
new
Error
(
'invaild data'
));
}
...
...
@@ -166,7 +174,7 @@ export default {
// 当图像加载完成后执行
image
.
onload
=
()
=>
{
// 创建一个 Canvas 元素
const
canvas
=
getWatermarkCanvasImg
(
this
.
player
.
width
,
this
.
player
.
height
,
'文安智能'
,
image
);;
const
canvas
=
getWatermarkCanvasImg
(
this
.
player
.
width
,
this
.
player
.
height
,
this
.
watermarkText
,
image
);;
// 将带有水印的 Canvas 转换回 base64
const
watermarkedBase64
=
canvas
.
toDataURL
(
'image/png'
);
...
...
h5/src/views/player/vionPlayerDemo.vue
View file @
aa48bdd
...
...
@@ -5,7 +5,7 @@
<vion-player
ref=
"vionPlayer"
:type=
"playerType"
:datetime-range=
"datetimeRange"
watermarkText=
"
方案智能
"
watermarkText=
"
文安智能123
"
@
ptz-control=
"handlePtz"
/>
</div>
...
...
@@ -68,7 +68,9 @@ export default {
console
.
log
(
'handleScreenshot'
,
data
);
this
.
base64Url
=
data
;
this
.
dialogVisible
=
true
;
});
}).
catch
(
err
=>
{
console
.
error
(
err
);
})
},
handlePause
()
{
this
.
$refs
.
vionPlayer
.
pause
();
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment