Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_03
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
dfzx_03
Commits
5dfcd1ef
Commit
5dfcd1ef
authored
Nov 19, 2019
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first
parent
3747dd67
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9975 additions
and
14 deletions
+9975
-14
upload-video.component.ts
src/app/common/upload-video/upload-video.component.ts
+5
-2
form.component.html
src/app/form/form.component.html
+1
-1
form.component.ts
src/app/form/form.component.ts
+2
-0
play.component.html
src/app/play/play.component.html
+10
-6
play.component.ts
src/app/play/play.component.ts
+55
-5
yarn.lock
yarn.lock
+9902
-0
No files found.
src/app/common/upload-video/upload-video.component.ts
View file @
5dfcd1ef
...
...
@@ -81,7 +81,7 @@ export class UploadVideoComponent implements OnChanges, OnDestroy {
handleChange
(
info
:
{
type
:
string
,
file
:
UploadFile
,
event
:
any
}):
void
{
console
.
log
(
'
info:
'
,
info
);
//
console.log('info:' , info);
switch
(
info
.
type
)
{
case
'
start
'
:
...
...
@@ -102,6 +102,7 @@ export class UploadVideoComponent implements OnChanges, OnDestroy {
case
'
success
'
:
console
.
log
(
'
success
'
);
this
.
uploadSuccess
(
info
.
file
);
// this.beforeUpload(info.file);
...
...
@@ -110,7 +111,9 @@ export class UploadVideoComponent implements OnChanges, OnDestroy {
break
;
case
'
progress
'
:
this
.
progress
=
parseInt
(
info
.
event
.
percent
,
10
);
this
.
doProgress
(
this
.
progress
);
// this.doProgress(this.progress);
// console.log('progress: ', this.progress);
break
;
}
}
...
...
src/app/form/form.component.html
View file @
5dfcd1ef
...
...
@@ -7,7 +7,7 @@
[
src
]="
item
.
contentObj
.
video_url
|
resource
"
controls
(
loadeddata
)="
videoLoaded
($
event
,
item
)"
(
error
)="
videoError
($
event
)"
(
seeked
)="
videoSeeked
($
event
,
false
)"
(
seeked
)="
videoSeeked
($
event
)"
#
videoNode
></video>
<!--&& item.contentObj.video_url.constructor.name === 'String'-->
<div
*
ngIf=
"!item.contentObj.video_url"
>
...
...
src/app/form/form.component.ts
View file @
5dfcd1ef
...
...
@@ -70,6 +70,8 @@ export class FormComponent implements OnInit, OnChanges {
// });
// }
this
.
item
=
{};
this
.
item
.
contentObj
=
{};
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
getData
((
data
)
=>
{
...
...
src/app/play/play.component.html
View file @
5dfcd1ef
<!--<div>-->
<!--<h1>{{aaa.a}}</h1>-->
<div
class=
"p-courseware-video"
[
style
.
background-image
]="
hasVideo
?
''
:
'
url
(
assets
/
default
/
video-not-upload
.
jpg
)'"
>
<!--<h1 style="color: #ffffff">{{aaa.a}}</h1>-->
<video
*
ngIf=
"hasVideo"
[
src
]="
data
.
contentObj
.
video_url
"
width=
"100%"
height=
"100%"
...
...
@@ -38,12 +47,7 @@
<div
class=
"i-cursor"
[
style
.
left
]="
progress
+
'%'"
></div>
</div>
<div
class=
"k-video-control-time-total"
>
{{duration | time}}
</div>
<!--<div class="k-video-control-tool">-->
<!--<div class="i-tool-btn" (tap)="onBtnQuickSeek(-10)">-10</div>-->
<!--<div class="i-tool-btn" (tap)="onBtnQuickSeek(-5)">-5</div>-->
<!--<div class="i-tool-btn" (tap)="onBtnQuickSeek(5)">+5</div>-->
<!--<div class="i-tool-btn" (tap)="onBtnQuickSeek(10)">+10</div>-->
<!--</div>-->
</div>
</div>
src/app/play/play.component.ts
View file @
5dfcd1ef
import
{
AfterViewInit
,
Component
,
ElementRef
,
Input
,
OnDestroy
,
OnInit
,
ViewChild
}
from
'
@angular/core
'
;
import
{
AfterViewInit
,
ApplicationRef
,
Component
,
ElementRef
,
Input
,
OnDestroy
,
OnInit
,
ViewChild
}
from
'
@angular/core
'
;
@
Component
({
selector
:
'
app-play
'
,
...
...
@@ -24,14 +24,18 @@ export class PlayComponent implements AfterViewInit, OnInit, OnDestroy {
KEY
=
'
dfzx_03
'
;
playBtnImg
=
''
;
// aaa;
constructor
()
{
constructor
(
private
appRef
:
ApplicationRef
)
{
}
ngOnInit
()
{
// console.log(this.data.contentObj)
// this.hasVideo = !!this.data.contentObj.video_url && typeof this.data.contentObj.video_url === 'string';
this
.
data
=
{};
this
.
data
.
contentObj
=
{};
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
getData
((
data
)
=>
{
...
...
@@ -42,19 +46,43 @@ export class PlayComponent implements AfterViewInit, OnInit, OnDestroy {
this
.
data
=
{};
}
console
.
log
(
'
data:
'
,
data
);
console
.
log
(
'
data:
'
,
this
.
data
);
if
(
!
this
.
data
.
contentObj
)
{
this
.
data
.
contentObj
=
{};
this
.
data
.
contentObj
.
video_url
=
'
assets/default/demo.mp4
'
;
// this.initDefaultData();
}
this
.
initDefaultData
();
console
.
log
(
'
this.data.contentObj.video_url:
'
,
this
.
data
.
contentObj
.
video_url
);
this
.
hasVideo
=
!!
this
.
data
.
contentObj
.
video_url
&&
typeof
this
.
data
.
contentObj
.
video_url
===
'
string
'
;
console
.
log
(
'
hasVideo:
'
,
this
.
hasVideo
);
this
.
playBtnImg
=
'
assets/play/btn-play.png
'
;
this
.
refresh
();
},
this
.
KEY
);
// this.aaa = {a: 1};
// setInterval(() => {
// this.aaa.a ++;
// }, 1000);
setInterval
(()
=>
{
this
.
refresh
();
},
1000
);
}
initDefaultData
()
{
if
(
!
this
.
data
.
contentObj
.
video_url
)
{
this
.
data
.
contentObj
.
video_url
=
'
assets/default/demo.mp4
'
;
}
}
playVideo
()
{
...
...
@@ -62,6 +90,15 @@ export class PlayComponent implements AfterViewInit, OnInit, OnDestroy {
if
(
!
this
.
videoNodeRef
)
{
return
;
}
if
(
!
this
.
player
)
{
this
.
ngAfterViewInit
();
}
if
(
!
this
.
player
)
{
console
.
log
(
'
player not exist
'
);
return
;
}
this
.
initCover
=
false
;
if
(
this
.
player
.
paused
)
{
const
playPromise
=
this
.
player
.
play
();
...
...
@@ -84,9 +121,13 @@ export class PlayComponent implements AfterViewInit, OnInit, OnDestroy {
}
else
{
this
.
player
.
pause
();
}
this
.
refresh
();
}
ngAfterViewInit
()
{
console
.
log
(
'
in ngAfterViewInit
'
);
if
(
!
this
.
videoNodeRef
)
{
return
;
}
...
...
@@ -113,6 +154,8 @@ export class PlayComponent implements AfterViewInit, OnInit, OnDestroy {
};
this
.
player
.
addEventListener
(
"
ended
"
,
()
=>
{
this
.
playBtnImg
=
'
assets/play/btn-replay.png
'
;
this
.
refresh
();
})
setTimeout
(()
=>
{
this
.
initCover
=
this
.
data
.
contentObj
.
video_cover_url
;
...
...
@@ -148,4 +191,11 @@ export class PlayComponent implements AfterViewInit, OnInit, OnDestroy {
const
{
target
,
offsetX
}
=
event
;
this
.
player
.
currentTime
=
this
.
player
.
duration
*
offsetX
/
target
.
clientWidth
;
}
refresh
()
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
},
1
);
}
}
yarn.lock
0 → 100644
View file @
5dfcd1ef
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