Skip to content

Commit

Permalink
feat(article-card): add support for audio/video podcast feeds
Browse files Browse the repository at this point in the history
Closes #164.
  • Loading branch information
EdricChan03 committed Feb 13, 2020
1 parent 3ee8cf0 commit 53f3f68
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<mat-chip-list *ngIf="articleCategories.length > 0">
<mat-chip *ngFor="let category of articleCategories" [innerHTML]="category"></mat-chip>
</mat-chip-list>
<audio *ngIf="enclosureLink && enclosureIsAudioType" [src]="enclosureLink" controls preload="metadata"></audio>
<video *ngIf="enclosureLink && enclosureIsVideoType" [src]="enclosureLink" controls preload="metadata"></video>
</mat-card-content>
<mat-divider></mat-divider>
<mat-card-actions align="end">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,27 @@ export class ArticleCardComponent implements OnInit {
return;
}

get enclosureIsAudioType(): boolean {
if ('enclosure' in this.article && 'type' in this.article.enclosure) {
return this.article.enclosure.type.startsWith('audio');
}
return false;
}

get enclosureIsVideoType(): boolean {
if ('enclosure' in this.article && 'type' in this.article.enclosure) {
return this.article.enclosure.type.startsWith('video');
}
return false;
}

get enclosureLink(): string {
if ('enclosure' in this.article && 'link' in this.article.enclosure) {
return this.article.enclosure.link;
}
return;
}

ngOnInit() {
if (this.settingsStorage.settings) {
if ('openNewTab' in this.settingsStorage.settings) {
Expand Down

0 comments on commit 53f3f68

Please sign in to comment.