Commit feec6013 authored by liujiangnan's avatar liujiangnan

feat: 封面

parent ed3dd05c
...@@ -18,28 +18,16 @@ ...@@ -18,28 +18,16 @@
</div> </div>
</div> </div>
</div> </div>
<div nz-col nzSpan="4" class="-col-4" style=" display: flex; <div nz-col nzSpan="8" class="-col-4" style="display: flex; justify-content: center;">
justify-content: center;">
<app-upload-video <app-upload-video
(videoUploaded)="onVideoUploadSuccess($event)" (videoUploaded)="onVideoUploadSuccess($event)"
[item]="item" [item]="item"
[videoUrl]="item.contentObj.video_url"></app-upload-video> [videoUrl]="item.contentObj.video_url"></app-upload-video>
</div>
<div nz-col nzSpan="4" style="text-align: center;">
<button nz-button nzType="primary" <button nz-button nzType="primary"
style="margin-bottom: 1rem" style="margin-bottom: 1rem"
(click)="setVideoCover()"> (click)="setVideoCover()">
Set Video Cover Set Video Cover
</button> </button>
</div>
</div>
<div class="row" style="margin-top: 1rem"
*ngIf="item.contentObj.video_url">
<div class="col-8">
<img *ngIf="item.contentObj.pic_id"
[src]="item.contentObj.pic_id"
style="width:100%;overflow: hidden;box-shadow: 0 0 20px 0px #444;"/>
</div> </div>
</div> </div>
...@@ -101,15 +101,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -101,15 +101,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.nzMessageService.error('video error'); this.nzMessageService.error('video error');
} }
videoSeeked(evt) { videoSeeked(evt) {
return return;
const video = evt.target;
if (video.src && video.src.startsWith('blob:')) {
return;
}
if (!this.item.contentObj.pic_id) {
this.setVideoCover();
this.newVideoCover = false;
}
} }
setVideoCover() { setVideoCover() {
...@@ -134,6 +126,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -134,6 +126,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.http.post(this.uploadUrl, formData).subscribe( this.http.post(this.uploadUrl, formData).subscribe(
(res: any) => { (res: any) => {
(window as any).courseware.sendEvent("screenshot", {"url": res.url}, this.saveKey);
this.item.contentObj.pic_id = res.url; this.item.contentObj.pic_id = res.url;
this.save(); this.save();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment