Display VTT transcripts in audio/video players#7418
Display VTT transcripts in audio/video players#7418eltiffster wants to merge 43 commits intomainfrom
Conversation
… into simple form
…notations tab of Clover IIIF viewer. "l" is supposed to refer to the <ItemStyled> object in Annotation (https://github.com/samvera-labs/clover-iiif/blob/main/src/components/Viewer/InformationPanel/Annotation/Item.styled.tsx). In the minified version of this file, this should actually be uppercase L, not lowercase l. `l("span",{style:{backgroundImage` was changed to `L("span",{style:{backgroundImage` `return l(n9,{dir:P,"data-format"` was changed to `return L(n9,{dir:P,"data-format"` There appears to be an unnecessary call to `l()` in the following switch/case statement: ``` case "text/vtt": return l(HQ, { inlineCues: k, label: A, vttUri: ((D = y[0]) == null ? void 0 : D.id) || void 0 }); ``` In fact, `return l(HQ,{inlineCues:k` can be changed to `return HQ({inlineCues:k` since HQ is a function in the minified file.
…ion for other file types seems unfinished and doesn't work.
…f the solr document. Do not make language a required field for a file set.
…ix some formatting and specs.
…s with multiple files are visible.
… Remove tests for code that was already tested/covered elsewhere.
… since it's not required by the viewer.
Test Results 17 files ± 0 1 errors 16 suites - 1 3h 21m 57s ⏱️ - 7m 57s For more details on these parsing errors, see this check. Results for commit 97da895. ± Comparison against base commit cae6920. This pull request removes 447 and adds 473 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
…locks (instead of describe)
…uery. Rename form_transcript_ids_select_for to transcript_ids_select_options
… both FileSets and Hyrax::FileSets.
kirkkwang
left a comment
There was a problem hiding this comment.
This looks good to me, i think the only thing is to maybe take out the ActiveTriples::Resource case, it doesn't seem likely as a case at the moment anyways.
orangewolf
left a comment
There was a problem hiding this comment.
This is really great work. I have a few questions and concerns, but the feature as a whole looks great. Let me know if you want to pair up on the m3 part or the file streaming.
…transcripts. It was created for a hypothetical edge case in which someone might configure a controlled vocabulary field (e.g. Hyrax::ControlledVocabularies::Language) in an AF-based app. Removed since it doesn't refer to any existing use case in Hyrax.
Thanks, @orangewolf! I'm not very familiar with the flexible metadata features, so I'd appreciate any help I can get. I tried adding properties:
transcript_ids:
available_on:
class:
- Hyrax::FileSet
indexing:
- transcript_ids_ssim
data_type: array
display_label: Transcripts
form:
primary: false
property_uri: http://vocabulary.samvera.org/ns#transcriptIdsAnd also to both |
So I had to delete the first default profile from the database, which allowed How should this change be handled for those who have already created a flexible schema? Should there be documentation advising people to add |
…nclude_metadata. Add `transcript_ids` to default flexible metadata profiles.
…t can be optional for apps with flexible metadata.
I updated the description so we can catch it in the release notes. |
Summary For Release Notes
Allow users to select and display WebVTT files as transcripts/captions for audio/video files.
If using Flexible Metadata please add the following to your profile.
Guidance Setup:
.dassieor/app/samvera/hyrax-webappin Docker), runrails generate hyrax:iiif_viewer cloverto installrails destroy hyrax:iiif_viewer clover, thenrails generate hyrax:iiif_viewer cloverto reinstall fresh copies of the viewer files. Theclover.jsfile was altered to fix this issue and an extra class was added to adivinclover.html.erb.Type of change (for release notes)
notes-major(I think) due to needing to install a new gem for convertinglanguagefield values into a language code readable by the IIIF viewerDetailed Description
This is a continuation of work started before/during the March 2026 Community Sprint. More context/discussion on implementation was recorded on the the Sprint Board.
After uploading VTT file(s) to a work with an audio/video (AV) file, users can choose to use the VTT file as the subtitles/captions file for the corresponding audio/video. This is done by editing the AV file set, selecting the VTT file by title, and saving the AV file set (see screenshot below). Under the hood, the VTT file set ids are saved to the
transcript_idsattribute of the AV file and indexed astranscript_ids_ssimin the AV file's Solr document.The transcript(s) form is populated by a Solr query that searches for "sibling" file sets (i.e. file sets of the same parent work as the AV file set) with a
text/vttmime type. Currently,text/vttis the only accepted mime type, but other mime types could be added in future. Users can select multiple VTT files per audio/video file. This approach also supports a nested work structure where a child work has a different transcript than other child works or its parent work.Selected transcripts are displayed via a
<track>element in default audio/video partials. When using a IIIF AV viewer, the transcript is displayed in a IIIF manifest via an annotation, following the pattern of this IIIF cookbook recipe:Thanks to @kirkkwang and @trmccormick for their work on this!
Changes proposed in this pull request:
transcript_idsandlanguageproperties/attributes to ActiveFedora and Hyrax file set classes, their respective form classes, and their respective indexerstranscript_idsandlanguageform fields in the file set edit formHyrax::FileSetPresentertorender_media_display_partialinstead of a Solr document (inapp/views/hyrax/file_sets/edit.html.erb)<track>elements toapp/views/hyrax/file_sets/media_display/_video.html.erbandapp/views/hyrax/file_sets/media_display/_audio.html.erb: initial idea and technical plan by @trmccormickPossible Future Work
views/hyrax/file_sets/_form.html.erbpartial for ActiveFedora file sets, while the Valkyrie version uses thehydra-editorgem, which renders partials inviews/records/edit_fields. Is there a reason for this difference? Should the form be refactored?clover.jsfile.@samvera/hyrax-code-reviewers