Skip to content

Adds AV Tests and Caption Functionality - #1796

Open
K8Sewell wants to merge 9 commits into
devfrom
issue-1750-add-av-tests
Open

K8Sewell wants to merge 9 commits into
devfrom
issue-1750-add-av-tests

Conversation

@K8Sewell

@K8Sewell K8Sewell commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description of what you did:

  • Added tests for AV media
  • Added functionality to read transcripts from cookbook examples

Related Issue

#1750

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
universalviewer Ready Ready Preview Sep 8, 2026 7:36pm UTC
universalviewer.dev Ready Ready Preview Sep 8, 2026 7:36pm UTC

Request Review

return typeGroup === "audio" || typeGroup === "video";
}

// vtt, srt, csv

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was unable to find support for csv.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added tests that confirm functionality of both vtt and srt.

return false;
}

const captionTypes = new Set<String>(["text/vtt", "text/srt"]);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@K8Sewell
K8Sewell marked this pull request as ready for review July 2, 2026 21:53
@demiankatz

Copy link
Copy Markdown
Contributor

Thanks, @K8Sewell, this is great! I haven't had a chance to look closely since I'm preparing to leave for my trip and need to choose my battles -- but I'll be happy to look closer when I get back if you want me to. In the meantime, I imagine that @LanieOkorodudu might be a good candidate for reviewing, since she's been more heavily involved in test code lately and probably has some good insights!

Comment thread __tests__/av_tests.js
});
}, 60000);

it("loads the AV manifest into the mediaelement player", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@K8Sewell, Thanks for putting this together, Do you think it's worth adding the canvas title displays "Video Example 3", and that the video can actually play, continue for around 10 seconds, and then pause successfully.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LanieOkorodudu thank you so much for this suggestion! I implemented it in the reintegrate AV PR but forgot to add them here as well. Will get that fixed asap and will re-request your review when they are ready. Thanks again!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a play and pause test to the first AV manifest but to conserve speed of our tests I only included it for that single manifest. If you think I should add it for multiple I can certainly do that. Because the other tests of the other manifests confirm the loading I thought one play/pause expectation was sufficient given the 10 second time expenditure but am happy to defer to what you think is best! Really appreciate your insight!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay we probably leave this one to just play/pause. Thanks for all your work here.

Comment thread __tests__/av_tests.js
});

// Play/pause button.
const playButton = await avPage.$(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, like play for 10 seconds and and pause to confirm the video is actually play for seconds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix incoming.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure with the 10 second time expenditure if it should be included for each manifest so I only included one but will happily update for each to have that expectation if you think that is better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also shorten the time to 3 seconds or something like that if you would prefer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @K8Sewell. yes you are aright 3 sec is okay to confirm the video actually play.

Comment thread __tests__/av_tests.js
});
}, 60000);

it("loads the AV manifest into the AV center panel", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also confirmed that the title has "Preludio e Coro d'introduzione – Bel conforto al mietitore" as it loaded.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for confirming this! I can add an expectation for this as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up adding tests for each manifest's title. Thank you for this suggestion!

@LanieOkorodudu

Copy link
Copy Markdown
Contributor

I really like the approach of creating a separate folder for each component to test. It makes everything much easier to maintain. Thanks! @K8Sewell

@K8Sewell

K8Sewell commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

I really like the approach of creating a separate folder for each component to test. It makes everything much easier to maintain. Thanks! @K8Sewell

Happy to! Hopefully this is just the start of adding many more helpful tests. :)

@K8Sewell

K8Sewell commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

May be able to close ticket #747 and PR #95 with this work if accepted.

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @K8Sewell, and sorry it has taken me so long to get back to this. I know @LanieOkorodudu is excited to get the new testing structure in place so she can build some more of her work on top of it!

See below for a few comments, questions and suggestions.

It may also be a good idea to try merging the latest dev branch into this branch to make sure that changes in, e.g., #1856 haven't broken anything here.

Comment thread __tests__/av_tests.js
// AV (audiovisual) manifest for AV-specific behaviour. A simple single-file
// AV manifest (no ranges) is rendered by the mediaelement extension.
const AV_VIDEO_MANIFEST =
"https://iiif.io/api/cookbook/recipe/0003-mvm-video/manifest.json";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes me slightly nervous to depend on an external URL for our test -- but I guess even if we copied this manifest locally, we would still rely on external servers for the actual video content, so maybe it's unavoidable.

Just wondering if we should consider creating local copies of anything, or if we're confident in relying on iiif.io -- the advantage to the local copy is it should be more stable (e.g. a test won't unexpectedly fail because an upstream manifest changed unexpectedly), though conversely, this means that we would have to manually synchronize any future recipe updates.

I don't want to hold up the PR with a long debate about this -- I can be persuaded either way -- but just wanted to raise the issue to see if anyone has strong opinions.

Comment thread __tests__/av_tests.js
const AV_SUPPLEMENTING_EXTERNAL_MANIFEST = `${BASE_URL}/test-fixtures/supplementing-external-captioned-video-manifest.json`;

const viewerUrl = (manifestUrl) => {
//const separator = BASE_URL.includes("#?") ? "&" : "#?";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be needed:

Suggested change
//const separator = BASE_URL.includes("#?") ? "&" : "#?";

if (!label || typeof label === "string") {
return label || undefined;
}
const values = label[Object.keys(label)[0]];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to pick the first key arbitrarily? Should we try to match the selected user language, or am I misunderstanding what's going on here?

// over https β€” an http -> https upgrade redirect whose 301 response lacks
// CORS headers is blocked by the browser even though its destination is
// readable.
async resolveCaptionSource(src: string): Promise<string> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems promising as a possible resolution to the problems I encountered when testing #1298 on Villanova's https://digital.library.villanova.edu/Item/vudl:829943/Manifest manifest. I'll be interested to try that PR again after this one is merged!

This branch was successfully deployed

2 active deployments
Preview – universalviewer.dev β€” d550cee6 Deployed Sep 8, 2026 by vercel[bot]
Preview – universalviewer β€” d550cee6 Deployed Sep 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In testing

Development

Successfully merging this pull request may close these issues.

3 participants