Skip to content

Commit

Permalink
Set the video type attribute on videos items, close #199
Browse files Browse the repository at this point in the history
  • Loading branch information
MurhafSousli committed Oct 3, 2018
1 parent e01a13b commit 06b3601
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { Component, Input, OnInit, ViewChild, ElementRef, ChangeDetectionStrateg
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<video #video controls poster="{{poster}}" (error)="error.emit($event)">
<source *ngFor="let source of videoSources" src="{{source}}"/>
<source *ngFor="let src of videoSources" src="{{src?.url}}" type="{{src?.type}}"/>
</video>
`
})
export class GalleryVideoComponent implements OnInit {

videoSources: string[];
videoSources: {url: string, type?: string}[];

@Input() src: string | string[];
@Input() src: string | {url: string, type?: string}[];
@Input() poster: string;

@Input('pause') set pauseVideo(shouldPause: boolean) {
Expand All @@ -33,7 +33,7 @@ export class GalleryVideoComponent implements OnInit {
// If video has multiple sources
this.videoSources = [...this.src];
} else {
this.videoSources = [this.src];
this.videoSources = [{ url: this.src }];
}
}
}

0 comments on commit 06b3601

Please sign in to comment.