mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
#885 check bitsteam fail
This commit is contained in:
@@ -4,26 +4,29 @@
|
|||||||
message="{{ 'loading.default' | translate }}"
|
message="{{ 'loading.default' | translate }}"
|
||||||
[showMessage]="false"
|
[showMessage]="false"
|
||||||
></ds-loading>
|
></ds-loading>
|
||||||
<div class="media-viewer" *ngIf="mediaList.length > 0">
|
<div class="media-viewer" *ngIf="!isLoading">
|
||||||
<ng-container *ngIf="options.video">
|
<ng-container *ngIf="mediaList.length > 0">
|
||||||
<ng-container
|
<ng-container *ngIf="options.video">
|
||||||
*ngIf="
|
<ng-container
|
||||||
mediaList[0]?.format === 'video' || mediaList[0]?.format === 'audio'
|
*ngIf="
|
||||||
"
|
mediaList[0]?.format === 'video' || mediaList[0]?.format === 'audio'
|
||||||
>
|
"
|
||||||
<ds-media-viewer-video [medias]="mediaList"></ds-media-viewer-video>
|
>
|
||||||
|
<ds-media-viewer-video [medias]="mediaList"></ds-media-viewer-video>
|
||||||
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
<ng-container *ngIf="options.image">
|
||||||
<ng-container *ngIf="options.image">
|
<ng-container *ngIf="mediaList[0]?.format === 'image'">
|
||||||
<ng-container *ngIf="mediaList[0]?.format === 'image'">
|
<ds-media-viewer-image [images]="mediaList"></ds-media-viewer-image>
|
||||||
<ds-media-viewer-image [images]="mediaList"></ds-media-viewer-image>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container
|
<ng-container
|
||||||
*ngIf="
|
*ngIf="
|
||||||
(!options.image || mediaList[0]?.format !== 'image') &&
|
((!options.image || mediaList[0]?.format !== 'image') &&
|
||||||
(!options.video || mediaList[0]?.format !== 'video') &&
|
(!options.video || mediaList[0]?.format !== 'video') &&
|
||||||
(!options.video || mediaList[0]?.format !== 'audio')
|
(!options.video || mediaList[0]?.format !== 'audio')) ||
|
||||||
|
mediaList.length === 0
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<ds-media-viewer-image
|
<ds-media-viewer-image
|
||||||
|
@@ -41,22 +41,31 @@ export class MediaViewerComponent implements OnInit {
|
|||||||
this.mediaList$ = new BehaviorSubject([]);
|
this.mediaList$ = new BehaviorSubject([]);
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.loadRemoteData('ORIGINAL').subscribe((bitstreamsRD) => {
|
this.loadRemoteData('ORIGINAL').subscribe((bitstreamsRD) => {
|
||||||
this.loadRemoteData('THUMBNAIL').subscribe((thumbnailsRD) => {
|
if (bitstreamsRD.payload.page.length === 0) {
|
||||||
for (let index = 0; index < bitstreamsRD.payload.page.length; index++) {
|
|
||||||
bitstreamsRD.payload.page[index].format
|
|
||||||
.pipe(getFirstSucceededRemoteDataPayload())
|
|
||||||
.subscribe((format) => {
|
|
||||||
const current = this.mediaList$.getValue();
|
|
||||||
const mediaItem = this.createMediaViewerItem(
|
|
||||||
bitstreamsRD.payload.page[index],
|
|
||||||
format,
|
|
||||||
thumbnailsRD.payload && thumbnailsRD.payload.page[index]
|
|
||||||
);
|
|
||||||
this.mediaList$.next([...current, mediaItem]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
});
|
this.mediaList$.next([]);
|
||||||
|
} else {
|
||||||
|
this.loadRemoteData('THUMBNAIL').subscribe((thumbnailsRD) => {
|
||||||
|
for (
|
||||||
|
let index = 0;
|
||||||
|
index < bitstreamsRD.payload.page.length;
|
||||||
|
index++
|
||||||
|
) {
|
||||||
|
bitstreamsRD.payload.page[index].format
|
||||||
|
.pipe(getFirstSucceededRemoteDataPayload())
|
||||||
|
.subscribe((format) => {
|
||||||
|
const current = this.mediaList$.getValue();
|
||||||
|
const mediaItem = this.createMediaViewerItem(
|
||||||
|
bitstreamsRD.payload.page[index],
|
||||||
|
format,
|
||||||
|
thumbnailsRD.payload && thumbnailsRD.payload.page[index]
|
||||||
|
);
|
||||||
|
this.mediaList$.next([...current, mediaItem]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user