Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
ww_video
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
ww_video
Commits
d7b04e05
Commit
d7b04e05
authored
4 years ago
by
liujiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add video cover
parent
098bb6b0
master
v24
v23
v22
v21
v20
v19
v18
v17
v16
v15
v14
v13
v12
v11
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
5 deletions
+32
-5
play.component.ts
src/app/play/play.component.ts
+32
-5
No files found.
src/app/play/play.component.ts
View file @
d7b04e05
...
...
@@ -44,14 +44,16 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
// 获取数据
const
getData
=
(
window
as
any
).
courseware
.
getData
;
getData
((
data
)
=>
{
console
.
log
(
111
,
data
);
console
.
log
(
222
,
data
);
if
(
data
&&
typeof
data
===
'
object
'
)
{
this
.
data
=
data
;
}
this
.
hasVideo
=
!!
this
.
data
.
contentObj
.
video_url
;
window
[
"
air
"
].
hideAirClassLoading
(
this
.
saveKey
,
this
.
data
);
this
.
ngAfterDataInit
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
window
[
"
air
"
].
hideAirClassLoading
(
this
.
saveKey
,
this
.
data
);
},
this
.
saveKey
);
...
...
@@ -66,8 +68,11 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
ngOnChanges
(
data
)
{
}
ngAfterViewInit
()
{
}
ngAfterDataInit
()
{
if
(
!
this
.
videoNodeRef
)
{
return
;
}
...
...
@@ -94,11 +99,16 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
};
this
.
player
.
addEventListener
(
"
ended
"
,
()
=>
{
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
})
setTimeout
(()
=>
{
this
.
initCover
=
this
.
data
.
contentObj
.
pic_id
;
});
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
playVideo
()
{
...
...
@@ -106,7 +116,7 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
return
;
}
if
(
!
this
.
player
)
{
this
.
ngAfter
View
Init
();
this
.
ngAfter
Data
Init
();
}
if
(
!
this
.
player
)
{
return
;
...
...
@@ -125,6 +135,8 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
}
else
{
this
.
player
.
pause
();
}
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
...
...
@@ -135,15 +147,24 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
this
.
progress
=
Math
.
floor
((
player
.
currentTime
/
player
.
duration
)
*
100
);
console
.
log
(
this
.
progress
);
this
.
duration
=
this
.
player
.
duration
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
onBtnQuickSeek
(
delta
:
number
)
{
this
.
player
.
currentTime
+=
delta
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
onProgressMouseDown
(
event
)
{
this
.
player
.
pause
();
this
.
touchSeeking
=
true
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
onProgressMouseMove
(
event
)
{
...
...
@@ -151,11 +172,17 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
const
{
target
,
offsetX
}
=
event
;
this
.
progress
=
Math
.
floor
(
offsetX
/
target
.
clientWidth
*
100
);
}
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
onProgressMouseUp
(
event
)
{
const
{
target
,
offsetX
}
=
event
;
this
.
player
.
currentTime
=
this
.
player
.
duration
*
offsetX
/
target
.
clientWidth
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
refresh
()
{
...
...
This diff is collapsed.
Click to expand it.
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