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
Aug 15, 2020
by
liujiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add video cover
parent
098bb6b0
Changes
1
Hide 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
...
@@ -44,14 +44,16 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
// 获取数据
// 获取数据
const
getData
=
(
window
as
any
).
courseware
.
getData
;
const
getData
=
(
window
as
any
).
courseware
.
getData
;
getData
((
data
)
=>
{
getData
((
data
)
=>
{
console
.
log
(
111
,
data
);
console
.
log
(
222
,
data
);
if
(
data
&&
typeof
data
===
'
object
'
)
{
if
(
data
&&
typeof
data
===
'
object
'
)
{
this
.
data
=
data
;
this
.
data
=
data
;
}
}
this
.
hasVideo
=
!!
this
.
data
.
contentObj
.
video_url
;
this
.
hasVideo
=
!!
this
.
data
.
contentObj
.
video_url
;
window
[
"
air
"
].
hideAirClassLoading
(
this
.
saveKey
,
this
.
data
);
this
.
ngAfterDataInit
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
this
.
refresh
();
window
[
"
air
"
].
hideAirClassLoading
(
this
.
saveKey
,
this
.
data
);
},
this
.
saveKey
);
},
this
.
saveKey
);
...
@@ -66,8 +68,11 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
...
@@ -66,8 +68,11 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
ngOnChanges
(
data
)
{
ngOnChanges
(
data
)
{
}
}
ngAfterViewInit
()
{
ngAfterViewInit
()
{
}
ngAfterDataInit
()
{
if
(
!
this
.
videoNodeRef
)
{
if
(
!
this
.
videoNodeRef
)
{
return
;
return
;
}
}
...
@@ -94,11 +99,16 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
...
@@ -94,11 +99,16 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
};
};
this
.
player
.
addEventListener
(
"
ended
"
,
()
=>
{
this
.
player
.
addEventListener
(
"
ended
"
,
()
=>
{
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
this
.
refresh
();
})
})
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
initCover
=
this
.
data
.
contentObj
.
pic_id
;
this
.
initCover
=
this
.
data
.
contentObj
.
pic_id
;
});
});
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
}
playVideo
()
{
playVideo
()
{
...
@@ -106,7 +116,7 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
...
@@ -106,7 +116,7 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
return
;
return
;
}
}
if
(
!
this
.
player
)
{
if
(
!
this
.
player
)
{
this
.
ngAfter
View
Init
();
this
.
ngAfter
Data
Init
();
}
}
if
(
!
this
.
player
)
{
if
(
!
this
.
player
)
{
return
;
return
;
...
@@ -125,6 +135,8 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
...
@@ -125,6 +135,8 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
}
else
{
}
else
{
this
.
player
.
pause
();
this
.
player
.
pause
();
}
}
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
this
.
refresh
();
}
}
...
@@ -135,15 +147,24 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
...
@@ -135,15 +147,24 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
this
.
progress
=
Math
.
floor
((
player
.
currentTime
/
player
.
duration
)
*
100
);
this
.
progress
=
Math
.
floor
((
player
.
currentTime
/
player
.
duration
)
*
100
);
console
.
log
(
this
.
progress
);
console
.
log
(
this
.
progress
);
this
.
duration
=
this
.
player
.
duration
;
this
.
duration
=
this
.
player
.
duration
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
}
onBtnQuickSeek
(
delta
:
number
)
{
onBtnQuickSeek
(
delta
:
number
)
{
this
.
player
.
currentTime
+=
delta
;
this
.
player
.
currentTime
+=
delta
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
}
onProgressMouseDown
(
event
)
{
onProgressMouseDown
(
event
)
{
this
.
player
.
pause
();
this
.
player
.
pause
();
this
.
touchSeeking
=
true
;
this
.
touchSeeking
=
true
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
}
onProgressMouseMove
(
event
)
{
onProgressMouseMove
(
event
)
{
...
@@ -151,11 +172,17 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
...
@@ -151,11 +172,17 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
const
{
target
,
offsetX
}
=
event
;
const
{
target
,
offsetX
}
=
event
;
this
.
progress
=
Math
.
floor
(
offsetX
/
target
.
clientWidth
*
100
);
this
.
progress
=
Math
.
floor
(
offsetX
/
target
.
clientWidth
*
100
);
}
}
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
}
onProgressMouseUp
(
event
)
{
onProgressMouseUp
(
event
)
{
const
{
target
,
offsetX
}
=
event
;
const
{
target
,
offsetX
}
=
event
;
this
.
player
.
currentTime
=
this
.
player
.
duration
*
offsetX
/
target
.
clientWidth
;
this
.
player
.
currentTime
=
this
.
player
.
duration
*
offsetX
/
target
.
clientWidth
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
}
refresh
()
{
refresh
()
{
...
...
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