Skip to content

fix(videos): use live photo metadata for poster - #177

Merged
susnux merged 2 commits into
nextcloud-libraries:mainfrom
bulungasdeveloper:fix/livephoto-video-metadata
Oct 27, 2026
Merged

susnux merged 2 commits into
nextcloud-libraries:mainfrom
bulungasdeveloper:fix/livephoto-video-metadata

Conversation

@bulungasdeveloper

Copy link
Copy Markdown
Contributor

Summary

A video and a picture with the same name are not necessarily halves of the same live photo.
Resolve the poster through the DAV live photo metadata when the video carries it, and keep the
name pairing only for videos without metadata. A picture that already belongs to another live
photo is not used as a poster by name.

This makes video poster resolution symmetric with the image path, which already uses metadata.

How to test

  1. Upload a live photo pair where the still and the video have different names.
  2. Open the video in the viewer.
  3. The poster should be the correct still frame resolved via metadata-files-live-photo.
  4. Rename the still; the poster remains correct.

Unit tests added in __tests__/component/media.spec.ts and __tests__/utils.spec.ts.

Checklist

  • Code is properly formatted (eslint)
  • Sign-off message is added to all commits
  • Tests are included
  • Documentation not required
  • Backports requested where applicable: none for main

AI

  • The content of this PR was partly generated using AI

Resolve a video's poster from the live photo metadata before
falling back to the picture beside it. The metadata links both
halves by file id, so a video whose picture has a different name
still shows the right poster.

Keep the name fallback for videos without metadata, but never
pair a video with an image that belongs to another live photo.

Assisted-by: opencode:deepseek-v4.1-flash-free
Signed-off-by: Braux Martinez <martinezjb@hitss.com>
@bulungasdeveloper
bulungasdeveloper force-pushed the fix/livephoto-video-metadata branch from 2976b01 to 985573e Compare October 23, 2026 20:06
@bulungasdeveloper

Copy link
Copy Markdown
Contributor Author

Hi maintainers,
The branch has been rebased on top of main to remove the non-conventional merge commit created by Update branch.
Commit is conventional, DCO signed and AI-assisted.
The required checks are currently pending action_required due to fork protection. Could someone approve the workflow runs or review? Thanks!

@skjnldsv
skjnldsv requested a review from artonge October 24, 2026 18:14
@skjnldsv

Copy link
Copy Markdown
Contributor

@bulungasdeveloper thanks for the PR!

@artonge what do you think of that ? You have more knowledge than me on live photos metadata :))

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.03%. Comparing base (3f6dde8) to head (c188a68).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #177   +/-   ##
=======================================
  Coverage   92.02%   92.03%           
=======================================
  Files          54       54           
  Lines        4617     4621    +4     
  Branches     1006     1009    +3     
=======================================
+ Hits         4249     4253    +4     
  Misses        343      343           
  Partials       25       25           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@skjnldsv
skjnldsv requested a review from susnux October 25, 2026 07:45

@susnux susnux 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.

yes makes sense!

@skjnldsv only checked source which is good, not familiar with the projects tests though.

@bulungasdeveloper

Copy link
Copy Markdown
Contributor Author

@skjnldsv could you approve the workflow runs for this PR? All checks are in action_required state because the PR comes from a fork, so they have not run yet.

The PR is already approved by @susnux. Once the workflows are approved, I can address any failures right away.

Thanks!

@artonge artonge left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, it makes sense!
Not sure if I was the one to introduce the original behaviour, but I think it should be safe to not even fallback to the filename comparison.

@bulungasdeveloper

Copy link
Copy Markdown
Contributor Author

Thanks @susnux and @artonge for the reviews. All code and test checks are green. The only failing check is AI Policy (check-ai-trailers): it tries to add the AI assisted label, but PRs from forks get a read-only GITHUB_TOKEN, so the labels API returns 403. This is unrelated to the commit trailers. Since I only have read access to this repo, could a maintainer merge with admin override, or move the branch to the upstream repo so the workflow can use COMMAND_BOT_PAT? Thanks!

@susnux
susnux merged commit cb09a0a into nextcloud-libraries:main Oct 27, 2026
19 of 20 checks passed
@bulungasdeveloper
bulungasdeveloper deleted the fix/livephoto-video-metadata branch October 27, 2026 11:06
@skjnldsv

Copy link
Copy Markdown
Contributor

Yes, it makes sense! Not sure if I was the one to introduce the original behaviour, but I think it should be safe to not even fallback to the filename comparison.

nope, that was me and it's a customer requirement :)

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.

4 participants