support video in media-overlay #41

This commit is contained in:
Nicolas Constant 2019-02-27 23:07:30 -05:00
parent 8bc73810ba
commit 580c886b57
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 11 additions and 4 deletions

View File

@ -3,7 +3,12 @@
<fa-icon [icon]="faTimes"></fa-icon> <fa-icon [icon]="faTimes"></fa-icon>
</button> </button>
<img class="media-viewer-canvas__image" *ngIf="imageUrl" src="{{imageUrl}}" /> <img class="media-viewer-canvas__image" *ngIf="imageUrl" src="{{imageUrl}}" />
<video class="media-viewer-canvas__image" *ngIf="gifvUrl" role="application" loop autoplay (click)="attachmentSelected(0)"> <video class="media-viewer-canvas__image" *ngIf="gifvUrl" role="application" loop autoplay
(click)="attachmentSelected(0)">
<source src="{{ gifvUrl }}" type="video/mp4"> <source src="{{ gifvUrl }}" type="video/mp4">
</video> </video>
<video class="media-viewer-canvas__image" *ngIf="videoUrl" role="application" loop controls="controls"
(click)="attachmentSelected(0)">
<source src="{{ videoUrl }}" type="video/mp4">
</video>
</div> </div>

View File

@ -19,6 +19,7 @@ export class MediaViewerComponent implements OnInit {
imageUrl: string; imageUrl: string;
gifvUrl: string; gifvUrl: string;
videoUrl: string;
@Input('openedMediaEvent') @Input('openedMediaEvent')
set openedMediaEvent(value: OpenMediaEvent) { set openedMediaEvent(value: OpenMediaEvent) {
@ -46,12 +47,13 @@ export class MediaViewerComponent implements OnInit {
this.imageUrl = attachment.url; this.imageUrl = attachment.url;
} else if (attachment.type === 'gifv'){ } else if (attachment.type === 'gifv'){
this.gifvUrl = attachment.url; this.gifvUrl = attachment.url;
} else if (attachment.type === 'video'){
this.videoUrl = attachment.url;
} }
} }
close(): boolean { close(): boolean {
console.warn('xclose media');
this.closeSubject.next(true); this.closeSubject.next(true);
return false; return false;
} }