mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
#885 remove auto play and filter unsupported media types
This commit is contained in:
@@ -73,15 +73,17 @@ export class MediaViewerImageComponent implements OnInit {
|
||||
convertToGalleryImage(medias: MediaViewerItem[]): NgxGalleryImage[] {
|
||||
const mappadImages = [];
|
||||
for (const image of medias) {
|
||||
mappadImages.push({
|
||||
small: image.thumbnail
|
||||
? image.thumbnail
|
||||
: './assets/images/replacement_image.svg',
|
||||
medium: image.thumbnail
|
||||
? image.thumbnail
|
||||
: './assets/images/replacement_image.svg',
|
||||
big: image.bitstream._links.content.href,
|
||||
});
|
||||
if (image.format === 'image') {
|
||||
mappadImages.push({
|
||||
small: image.thumbnail
|
||||
? image.thumbnail
|
||||
: './assets/images/replacement_image.svg',
|
||||
medium: image.thumbnail
|
||||
? image.thumbnail
|
||||
: './assets/images/replacement_image.svg',
|
||||
big: image.bitstream._links.content.href,
|
||||
});
|
||||
}
|
||||
}
|
||||
return mappadImages;
|
||||
}
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<video
|
||||
#media
|
||||
[src]="medias[currentIndex].bitstream._links.content.href"
|
||||
[src]="filteredMedias[currentIndex].bitstream._links.content.href"
|
||||
id="singleVideo"
|
||||
[poster]="
|
||||
medias[currentIndex].thumbnail ||
|
||||
this.replacements[this.medias[this.currentIndex].format]
|
||||
filteredMedias[currentIndex].thumbnail ||
|
||||
replacements[filteredMedias[currentIndex].format]
|
||||
"
|
||||
preload="auto"
|
||||
preload="none"
|
||||
controls
|
||||
></video>
|
||||
<div class="buttons" *ngIf="medias?.length > 1">
|
||||
<div class="buttons" *ngIf="filteredMedias?.length > 1">
|
||||
<button
|
||||
class="btn btn-primary previous"
|
||||
[disabled]="currentIndex === 0"
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<button
|
||||
class="btn btn-primary next"
|
||||
[disabled]="currentIndex === medias.length - 1"
|
||||
[disabled]="currentIndex === filteredMedias.length - 1"
|
||||
(click)="nextMedia()"
|
||||
>
|
||||
{{ "media-viewer.next" | translate }}
|
||||
@@ -36,7 +36,7 @@
|
||||
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
|
||||
<button
|
||||
ngbDropdownItem
|
||||
*ngFor="let item of medias; let i = index"
|
||||
*ngFor="let item of filteredMedias; let i = index"
|
||||
class="list-element"
|
||||
(click)="selectedMedia(i)"
|
||||
>
|
||||
|
@@ -12,6 +12,8 @@ import { MediaViewerItem } from '../../../core/shared/media-viewer-item.model';
|
||||
export class MediaViewerVideoComponent implements OnInit {
|
||||
@Input() medias: MediaViewerItem[];
|
||||
|
||||
filteredMedias: MediaViewerItem[];
|
||||
|
||||
isCollapsed: boolean;
|
||||
currentIndex = 0;
|
||||
|
||||
@@ -24,6 +26,9 @@ export class MediaViewerVideoComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.isCollapsed = false;
|
||||
this.filteredMedias = this.medias.filter(
|
||||
(media) => media.format === 'audio' || media.format === 'video'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user