From 15dd7c203ba17514a75ecbcd5324eed84b585908 Mon Sep 17 00:00:00 2001 From: Mat Jordan Date: Fri, 12 May 2023 20:10:32 +0000 Subject: [PATCH] Update format for .m3u8 A/V IIIF canvas annotation body. --- src/api/response/iiif/presentation-api/items.js | 7 +++++-- test/unit/api/response/iiif/manifest.test.js | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/response/iiif/presentation-api/items.js b/src/api/response/iiif/presentation-api/items.js index 5c0b803c..36bb0ea5 100644 --- a/src/api/response/iiif/presentation-api/items.js +++ b/src/api/response/iiif/presentation-api/items.js @@ -5,10 +5,13 @@ function annotationType(workType) { } function buildAnnotationBody(fileSet, workType) { + const bodyType = annotationType(workType); const body = { id: buildAnnotationBodyId(fileSet, workType), - type: annotationType(workType), - format: fileSet.mime_type, + type: bodyType, + format: isAudioVideo(bodyType) + ? "application/x-mpegurl" + : fileSet.mime_type, height: fileSet.height || 100, width: fileSet.width || 100, }; diff --git a/test/unit/api/response/iiif/manifest.test.js b/test/unit/api/response/iiif/manifest.test.js index 6c298b4b..ca825e44 100644 --- a/test/unit/api/response/iiif/manifest.test.js +++ b/test/unit/api/response/iiif/manifest.test.js @@ -190,6 +190,7 @@ describe("A/V Work as IIIF Manifest response transformer", () => { expect(annotation.body.duration).to.eq(5.599); expect(annotation.body.type).to.eq("Video"); + expect(annotation.body.format).to.eq("application/x-mpegurl"); expect(annotation.body.id).to.eq(source.file_sets[0].streaming_url); }); });