Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix audio mime type for IIIF manifest #935

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

kirkkwang
Copy link
Contributor

Story

This commit will use audio/mpeg as the mime type for mp3 resources in the IIIF manifest instead of relying on the characterized mime type of the original file. This is a problem when our file is a wav file and it gets characterized as audio/x-wave which doesn't work with Universal Viewer. Instead, since we are serving up the mp3 derivative in the manifest, we should use audio/mpeg as the mime type. We also remove the ogg format because it is not being used and having that hard coded as audio/mpeg as well feels incorrect. This however doesn't solve the bigger problem of the File Set not gettig the original file in the first place but that is a separate issue and would need some investigation.

Ref:

Screenshots / Video

image
Manifest:
{
  "@context": [
    "http://www.w3.org/ns/anno.jsonld",
    "http://iiif.io/api/presentation/3/context.json"
  ],
  "type": "Manifest",
  "id": "https://dev.hyku.test/concern/generic_works/6f05a539-bfc3-4a0c-b173-47d427c5b59f/manifest",
  "label": {
    "none": [
      "audio test"
    ]
  },
  "rights": "http://rightsstatements.org/vocab/InC-OW-EU/1.0/",
  "metadata": [
    {
      "label": {
        "en": [
          "Title"
        ]
      },
      "value": {
        "none": [
          "audio test"
        ]
      }
    },
    {
      "label": {
        "en": [
          "Date modified"
        ]
      },
      "value": {
        "none": [
          "12/07/2023"
        ]
      }
    },
    {
      "label": {
        "en": [
          "Creator"
        ]
      },
      "value": {
        "none": [
          "<a href='https://dev.hyku.test/catalog?f%5Bcreator_sim%5D%5B%5D=Wang%2C+Kirk&locale=en'>Wang, Kirk</a>"
        ]
      }
    },
    {
      "label": {
        "en": [
          "Keyword"
        ]
      },
      "value": {
        "none": [
          "<a href='https://dev.hyku.test/catalog?f%5Bkeyword_sim%5D%5B%5D=test&locale=en'>test</a>"
        ]
      }
    },
    {
      "label": {
        "en": [
          "Resource type"
        ]
      },
      "value": {
        "none": [
          "<a href='https://dev.hyku.test/catalog?f%5Bresource_type_sim%5D%5B%5D=Audio&locale=en'>Audio</a>"
        ]
      }
    },
    {
      "label": {
        "en": [
          "Rights statement"
        ]
      },
      "value": {
        "none": [
          "<a href='http://rightsstatements.org/vocab/InC-OW-EU/1.0/'>In Copyright - EU Orphan Work</a>"
        ]
      }
    }
  ],
  "service": [
    {
      "@context": "http://iiif.io/api/search/1/context.json",
      "profile": "http://iiif.io/api/search/1/search",
      "label": "Search within this manifest",
      "type": "SearchService1",
      "id": "https://dev.hyku.test/catalog/6f05a539-bfc3-4a0c-b173-47d427c5b59f/iiif_search"
    }
  ],
  "items": [
    {
      "type": "Canvas",
      "id": "https://dev.hyku.test/concern/generic_works/6f05a539-bfc3-4a0c-b173-47d427c5b59f/manifest/canvas/c625a441-46d9-4647-b430-53386902656b",
      "label": {
        "none": [
          "file_example_WAV_1MG.wav"
        ]
      },
      "items": [
        {
          "type": "AnnotationPage",
          "id": "https://dev.hyku.test/concern/generic_works/6f05a539-bfc3-4a0c-b173-47d427c5b59f/manifest/canvas/c625a441-46d9-4647-b430-53386902656b/annotation_page/e9a765a5-eb70-4583-b6c8-17266c0aad70",
          "items": [
            {
              "type": "Annotation",
              "motivation": "painting",
              "body": {
                "id": "http://dev.hyku.test/iiif_av/content/c625a441-46d9-4647-b430-53386902656b/mp3",
                "type": "Sound",
                "duration": 5.94,
                "format": "audio/mpeg",
                "label": {
                  "none": [
                    "mp3"
                  ]
                }
              },
              "id": "https://dev.hyku.test/concern/generic_works/6f05a539-bfc3-4a0c-b173-47d427c5b59f/manifest/canvas/c625a441-46d9-4647-b430-53386902656b/annotation_page/e9a765a5-eb70-4583-b6c8-17266c0aad70/annotation/5b7e8f13-e820-4949-926a-3d3b007ec86c",
              "target": "https://dev.hyku.test/concern/generic_works/6f05a539-bfc3-4a0c-b173-47d427c5b59f/manifest/canvas/c625a441-46d9-4647-b430-53386902656b"
            }
          ]
        }
      ],
      "thumbnail": [],
      "duration": 5.94
    }
  ],
  "viewingHint": "paged"
}

This commit will use `audio/mpeg` as the mime type for mp3 resources in
the IIIF manifest instead of relying on the characterized mime type of
the original file.  This is a problem when our file is a wav file and it
gets characterized as `audio/x-wave` which doesn't work with Universal
Viewer.  Instead, since we are serving up the mp3 derivative in the
manifest, we should use `audio/mpeg` as the mime type.  We also remove
the ogg format because it is not being used and having that hard coded
as `audio/mpeg` as well feels incorrect.  This however doesn't solve the
bigger problem of the File Set not gettig the original file in the first
place but that is a separate issue and would need some investigation.

Ref:
  - #887
@kirkkwang kirkkwang changed the title 🐛 Fix mime type for IIIF manifest 🐛 Fix audio mime type for IIIF manifest Dec 7, 2023
@kirkkwang kirkkwang merged commit a7e0a6a into main Dec 7, 2023
4 of 7 checks passed
@kirkkwang kirkkwang deleted the i887-fix-uv-for-audio-resources branch December 7, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants