Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uniapp_vedio
Project
Project
Details
Activity
Releases
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
android
uniapp_vedio
Commits
98817b0e
Commit
98817b0e
authored
Nov 13, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化自动播放
parent
9af139b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
30 deletions
+33
-30
recommendVideo.vue
vedio/pages/recommend/recommendVideo.vue
+1
-1
newVideoDetail.vue
vedio/pagesC/video/newVideoDetail.vue
+32
-29
No files found.
vedio/pages/recommend/recommendVideo.vue
View file @
98817b0e
...
@@ -127,7 +127,7 @@
...
@@ -127,7 +127,7 @@
}
}
},
},
stop
()
{
stop
()
{
audo
.
pause
()
//
audo.pause()
this
.
videoContext
?.
pause
()
this
.
videoContext
?.
pause
()
},
},
queryList
()
{
queryList
()
{
...
...
vedio/pagesC/video/newVideoDetail.vue
View file @
98817b0e
...
@@ -4,10 +4,10 @@
...
@@ -4,10 +4,10 @@
<swiper
class=
"swiper"
circular
@
change=
"swiperChange"
:current=
"current"
:vertical=
"true"
>
<swiper
class=
"swiper"
circular
@
change=
"swiperChange"
:current=
"current"
:vertical=
"true"
>
<swiper-item
v-for=
"(list, index) in displaySwiperList"
:key=
"index"
:style=
"'width:100%; height:100%;'"
>
<swiper-item
v-for=
"(list, index) in displaySwiperList"
:key=
"index"
:style=
"'width:100%; height:100%;'"
>
<view
:style=
"'width:100%; height:100%;'"
>
<view
:style=
"'width:100%; height:100%;'"
>
<video
v-if=
"Math.abs(displayIndex-index)==0 && list.vedioUrl"
:id=
"list.vedioI
d
"
<video
v-if=
"Math.abs(displayIndex-index)==0 && list.vedioUrl"
:id=
"list.vedioI
ndex
"
:controls=
"controls"
:loop=
"!isplay"
:enable-progress-gesture=
"false"
:show-loading=
"true"
:controls=
"controls"
:loop=
"!isplay"
:enable-progress-gesture=
"false"
:show-loading=
"true"
:show-fullscreen-btn=
"false"
@
ended=
"ended"
@
controlstoggle=
"controlstoggle"
@
click=
"tapVides()"
:show-fullscreen-btn=
"false"
@
ended=
"ended"
@
controlstoggle=
"controlstoggle"
@
click=
"tapVides()"
@
timeupdate=
"timeupdate"
style=
"width:100%; height:100%;background: #f56c6c;"
@
timeupdate=
"timeupdate"
style=
"width:100%; height:100%;background: #f56c6c;"
:autoplay=
"true"
:src=
"list.vedioUrl"
:poster=
"data.coverImage"
class=
"tsvideo"
play-btn-position=
"center"
:src=
"list.vedioUrl"
:poster=
"data.coverImage"
class=
"tsvideo"
play-btn-position=
"center"
object-fit=
"contain"
/>
object-fit=
"contain"
/>
<view
v-if=
"!isqp"
class=
"userInfo"
>
<view
v-if=
"!isqp"
class=
"userInfo"
>
...
@@ -132,7 +132,6 @@
...
@@ -132,7 +132,6 @@
ref
ref
}
from
"vue"
;
}
from
"vue"
;
let
audo
=
uni
.
createInnerAudioContext
()
export
default
{
export
default
{
name
:
"newVideoDetail"
,
name
:
"newVideoDetail"
,
mixins
:
[
common
],
mixins
:
[
common
],
...
@@ -186,19 +185,17 @@
...
@@ -186,19 +185,17 @@
// #endif
// #endif
this
.
windowWidth
=
uni
.
getSystemInfoSync
().
windowWidth
this
.
windowWidth
=
uni
.
getSystemInfoSync
().
windowWidth
this
.
windowHeight
=
uni
.
getSystemInfoSync
().
windowHeight
-
this
.
safeArea
-
this
.
ttuop
this
.
windowHeight
=
uni
.
getSystemInfoSync
().
windowHeight
-
this
.
safeArea
-
this
.
ttuop
console
.
log
(
this
.
windowHeight
)
console
.
log
(
this
.
windowHeight
)
this
.
getData
()
this
.
getData
()
},
},
onShow
()
{
onShow
()
{
// 从VIP页面返回关闭弹框
// 从VIP页面返回关闭弹框
this
.
down
()
this
.
down
()
// this.getData()
},
},
methods
:
{
methods
:
{
paySuccess
()
{
paySuccess
()
{
this
.
unlock
(
this
.
originIndex
)
this
.
unlock
(
this
.
originIndex
)
// this.getData()
},
},
showPayDialog
()
{
showPayDialog
()
{
let
isIOS
=
wx
.
getSystemInfoSync
().
platform
;
let
isIOS
=
wx
.
getSystemInfoSync
().
platform
;
...
@@ -222,13 +219,18 @@
...
@@ -222,13 +219,18 @@
timeupdate
(
event
)
{
timeupdate
(
event
)
{
// 自动播放下一集
// 自动播放下一集
if
(
event
.
detail
.
currentTime
>
0
&&
this
.
originList
[
this
.
originIndex
].
lock
)
{
if
(
event
.
detail
.
currentTime
>
0
&&
this
.
originList
[
this
.
originIndex
].
lock
)
{
uni
.
createVideoContext
(
''
+
this
.
originList
[
this
.
originIndex
].
vedioI
d
,
this
).
seek
(
0
);
uni
.
createVideoContext
(
''
+
this
.
originList
[
this
.
originIndex
].
vedioI
ndex
,
this
).
seek
(
0
);
uni
.
createVideoContext
(
''
+
this
.
originList
[
this
.
originIndex
].
vedioI
d
,
this
).
pause
();
uni
.
createVideoContext
(
''
+
this
.
originList
[
this
.
originIndex
].
vedioI
ndex
,
this
).
pause
();
this
.
unlock
(
this
.
originIndex
)
this
.
unlock
(
this
.
originIndex
)
}
}
},
},
selectThisVideo
(
index
)
{
selectThisVideo
(
index
)
{
this
.
down
();
this
.
down
();
if
(
this
.
originIndex
==
index
)
{
return
}
this
.
oid
=
this
.
originIndex
this
.
duration
=
20
;
this
.
duration
=
20
;
this
.
originIndex
=
index
this
.
originIndex
=
index
this
.
initSwiperData
(
this
.
originIndex
);
this
.
initSwiperData
(
this
.
originIndex
);
...
@@ -276,26 +278,29 @@
...
@@ -276,26 +278,29 @@
if
(
data
.
code
==
200
)
{
if
(
data
.
code
==
200
)
{
that
.
originList
[
that
.
originIndex
].
lock
=
false
that
.
originList
[
that
.
originIndex
].
lock
=
false
setTimeout
(()
=>
{
setTimeout
(()
=>
{
uni
.
createVideoContext
(
''
+
that
.
originList
[
that
.
originIndex
].
vedioId
,
uni
.
createVideoContext
(
''
+
that
.
originList
[
that
.
originIndex
]
.
vedioIndex
,
that
)
that
)
.
play
();
.
play
();
th
is
.
commitVideo
()
th
at
.
commitVideo
()
},
500
)
},
500
)
}
else
if
(
data
.
code
==
301
)
{
}
else
if
(
data
.
code
==
301
)
{
that
.
originList
[
that
.
originIndex
].
lock
=
false
that
.
originList
[
that
.
originIndex
].
lock
=
false
setTimeout
(()
=>
{
setTimeout
(()
=>
{
uni
.
createVideoContext
(
''
+
that
.
originList
[
that
.
originIndex
].
vedioId
,
uni
.
createVideoContext
(
''
+
that
.
originList
[
that
.
originIndex
]
.
vedioIndex
,
that
)
that
)
.
play
();
.
play
();
th
is
.
commitVideo
()
th
at
.
commitVideo
()
},
500
)
},
500
)
}
else
if
(
data
.
code
==
302
)
{
}
else
if
(
data
.
code
==
302
)
{
that
.
originList
[
that
.
originIndex
].
lock
=
false
that
.
originList
[
that
.
originIndex
].
lock
=
false
setTimeout
(()
=>
{
setTimeout
(()
=>
{
uni
.
createVideoContext
(
''
+
that
.
originList
[
that
.
originIndex
].
vedioId
,
uni
.
createVideoContext
(
''
+
that
.
originList
[
that
.
originIndex
]
.
vedioIndex
,
that
)
that
)
.
play
();
.
play
();
th
is
.
commitVideo
()
th
at
.
commitVideo
()
},
500
)
},
500
)
}
else
if
(
data
.
code
==
303
)
{
}
else
if
(
data
.
code
==
303
)
{
that
.
showPayDialog
()
that
.
showPayDialog
()
...
@@ -304,6 +309,7 @@
...
@@ -304,6 +309,7 @@
});
});
},
},
getData
()
{
getData
()
{
let
that
=
this
this
.
originList
=
[]
this
.
originList
=
[]
this
.
post
({
this
.
post
({
url
:
'/vedio/getIndexList'
,
url
:
'/vedio/getIndexList'
,
...
@@ -314,18 +320,18 @@
...
@@ -314,18 +320,18 @@
success
:
({
success
:
({
data
data
})
=>
{
})
=>
{
th
is
.
originList
=
data
.
list
th
at
.
originList
=
data
.
list
if
(
th
is
.
isPlayNext
==
1
)
{
if
(
th
at
.
isPlayNext
==
1
)
{
th
is
.
originIndex
=
this
.
data
.
recommendIndex
-
1
th
at
.
originIndex
=
that
.
data
.
recommendIndex
-
1
}
else
{
}
else
{
th
is
.
originIndex
=
this
.
data
.
seeIndex
-
1
th
at
.
originIndex
=
that
.
data
.
seeIndex
-
1
}
}
if
(
th
is
.
originIndex
>=
this
.
data
.
vedioTotal
||
this
.
originIndex
<
0
)
{
if
(
th
at
.
originIndex
>=
that
.
data
.
vedioTotal
||
that
.
originIndex
<
0
)
{
th
is
.
originIndex
=
0
th
at
.
originIndex
=
0
}
}
th
is
.
data
=
data
.
vedioMsg
th
at
.
data
=
data
.
vedioMsg
th
is
.
initSwiperData
(
this
.
originIndex
);
th
at
.
initSwiperData
(
that
.
originIndex
);
th
is
.
initEpisode
()
th
at
.
initEpisode
()
}
}
});
});
},
},
...
@@ -359,8 +365,6 @@
...
@@ -359,8 +365,6 @@
];
];
this
.
displaySwiperList
=
displayList
;
this
.
displaySwiperList
=
displayList
;
// audo.pause()
if
(
this
.
oid
>=
this
.
originList
.
length
)
{
if
(
this
.
oid
>=
this
.
originList
.
length
)
{
this
.
oid
=
0
this
.
oid
=
0
}
}
...
@@ -368,15 +372,14 @@
...
@@ -368,15 +372,14 @@
this
.
oid
=
this
.
originList
.
length
-
1
this
.
oid
=
this
.
originList
.
length
-
1
}
}
console
.
log
(
'++++++++++++上一条播放数据 Index:'
,
this
.
oid
)
console
.
log
(
'++++++++++++上一条播放数据 Index:'
,
this
.
oid
)
// uni.createVideoContext('' + this.originList[this.oid].vedioId, this).stop();
uni
.
createVideoContext
(
''
+
this
.
originList
[
this
.
oid
].
vedioIndex
,
this
).
pause
();
uni
.
createVideoContext
(
''
+
this
.
originList
[
this
.
oid
].
vedioId
,
this
).
pause
();
if
(
this
.
originList
[
originIndex
].
lock
)
{
if
(
this
.
originList
[
originIndex
].
lock
)
{
this
.
unlock
(
this
.
originIndex
)
this
.
unlock
(
this
.
originIndex
)
}
else
{
}
else
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// audo.play()
// audo.play()
uni
.
createVideoContext
(
''
+
this
.
originList
[
originIndex
].
vedioI
d
,
this
).
play
();
uni
.
createVideoContext
(
''
+
this
.
originList
[
originIndex
].
vedioI
ndex
,
this
).
play
();
this
.
commitVideo
()
this
.
commitVideo
()
},
500
)
},
500
)
}
}
...
...
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