Appendix of: Kiss, Tamás, and Zoltán Kanász-Nagy. 2020. “Record Page Media Player in DSpace 7”. Digitális Bölcsészet / Digital Humanities 3, L:3-L:17. https://doi.org/10.31400/dh-hun.2020.3.1475. * The development methodology we used for displaying image, audio and video content on the record page of DSpace 7 and the resultant code snippets are as follows: 1. Preparing record page media display: analyzing the descriptive records of all of the bitstreams associated with the DSpace record, we create an object of the type mediaViewerItem, that is, we map the bitstream resource descriptor to mediaViewerItem: Src\app\+item-page\media-viewer\media-viewer.component.ts /** * This method loads all the Bitstreams and Thumbnails and converts them to media item */ ngOnInit(): void { this.mediaList$ = new BehaviorSubject([]); this.isLoading = true; this.loadRemoteData('ORIGINAL').subscribe((bitstreamsRD) => { if (bitstreamsRD.payload.page.length === 0) { 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; }); } }); } 2. We use the Ngx-gallery module modified by Kolkov (https://www.npmjs.com/package/@kolkov/ngx-gallery) to display images. For the gallery to work, one needs to define three different image versions for each image file: a small and a medium-sized thumbnail, and a large image – for the latter, we use the originally uploaded image file. The code block below demonstrates that if a thumbnail was uploaded together with the original image file, it will be used by the media viewer. However, the media viewer will use a thumbnail generated by DSpace, if one is available. In the absence of any thumbnail, we provide a general-purpose thumbnail (replacement_image.svg). src\app\+item-page\media-viewer\media-viewer-image\media-viewer-image.component.ts /** * This method convert an array of MediaViewerItem into NgxGalleryImage array * @param medias input NgxGalleryImage array */ convertToGalleryImage(medias: MediaViewerItem[]): NgxGalleryImage[] { const mappadImages = []; for (const image of medias) { 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; } 3. Then we display the resulting image list with the aforementioned Kolkov Ngx-gallery module: src\app\+item-page\media-viewer\media-viewer-image\media-viewer-image.component.html