Skip to content

feat: improve external post embeds#2794

Open
alexdln wants to merge 2 commits into
npmx-dev:mainfrom
alexdln:feat/post-embeds-impr
Open

feat: improve external post embeds#2794
alexdln wants to merge 2 commits into
npmx-dev:mainfrom
alexdln:feat/post-embeds-impr

Conversation

@alexdln
Copy link
Copy Markdown
Member

@alexdln alexdln commented May 25, 2026

🧭 Context

Since I always think about improving the blog at the last minute, I'm doing it separately this time 🙃

Added full video support and improved post zones clickability. Now, in addition to video, we can also click to external embeds.

For video, I used an external library. It's the base approach for atproto projects, and I use it in mine as well

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 25, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment May 25, 2026 3:02pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview May 25, 2026 3:02pm
npmx-lunaria Ignored Ignored May 25, 2026 3:02pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 867851d9-f261-49b8-a128-8e5bbc44b130

📥 Commits

Reviewing files that changed from the base of the PR and between 6bfe7d0 and 165445f.

📒 Files selected for processing (1)
  • test/unit/a11y-component-coverage.spec.ts
✅ Files skipped from review due to trivial changes (1)
  • test/unit/a11y-component-coverage.spec.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Introduced a video player component with HLS streaming and automatic playback based on viewport visibility
    • Enhanced Bluesky post embeds with improved video rendering and clickable external embeds
  • Chores
    • Updated security headers to allow required video sources
    • Added hls.js dependency
  • Tests
    • Marked the new video player as intentionally excluded from a11y component coverage checks

Walkthrough

This PR introduces HLS video streaming for Bluesky post embeds. A new VideoPlayer component manages hls.js playback and viewport-based auto-play, BlueskyPostEmbed is updated to render playlists via VideoPlayer with a restructured embed template, and security headers are configured to allow video streaming from Bluesky endpoints and blob: URLs.

Changes

Video Streaming for Bluesky Embeds

Layer / File(s) Summary
VideoPlayer component with HLS and viewport-based playback
app/components/VideoPlayer.vue
New component declares src and autoplay props, manages Hls instance lifecycle with watch and onScopeDispose, logs connection errors, and uses useIntersectionObserver to conditionally play or pause video based on visibility and autoplay setting.
BlueskyPostEmbed structural and video rendering updates
app/components/global/BlueskyPostEmbed.client.vue
Adds playlist field to embed model, restructures post container from single anchored card to div wrapper with nested anchor, wraps external embeds in clickable links, and replaces thumbnail-based video UI with VideoPlayer component driven by post.embed?.playlist.
Security headers, dependency, and test update
modules/security-headers.ts, package.json, test/unit/a11y-component-coverage.spec.ts
CSP connect-src allows Bluesky video endpoints; CSP media-src allows blob: URLs; hls.js version 1.6.16 added to dependencies; VideoPlayer.vue added to accessibility test skip list.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: improve external post embeds' directly aligns with the main changes: adding video support and improving clickability of external embeds in post components.
Description check ✅ Passed The description clearly relates to the changeset, explaining the addition of video support using an external library and improved clickability for external embeds.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/components/VideoPlayer.vue 0.00% 18 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 25, 2026

📊 Dependency Size Changes

Warning

This PR adds 24.8 MB of new dependencies, which exceeds the threshold of 200 kB.

📦 Package 📏 Size
hls.js@1.6.16 24.8 MB

Total size change: 24.8 MB

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/components/global/BlueskyPostEmbed.client.vue (1)

200-213: 💤 Low value

Consider whether viewport-based autoplay is desired.

The VideoPlayer component supports an autoplay prop that triggers play/pause based on viewport intersection, but it isn't passed here. If auto-play when scrolling into view is desired, add :autoplay="true". The current setup requires manual user interaction, which may be intentional given the controls and muted attributes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/components/global/BlueskyPostEmbed.client.vue` around lines 200 - 213,
The template rendering a VideoPlayer for playlist embeds omits the component's
viewport-based autoplay prop, so the video won't auto-play when scrolled into
view; decide whether autoplay-on-intersection is desired and if so add the
:autoplay="true" prop to the <VideoPlayer> usage (keeping existing props like
controls, muted, loop) to enable the component's intersection-driven play/pause
behavior, otherwise leave as-is to require manual interaction.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/components/VideoPlayer.vue`:
- Around line 22-24: The HLS error handler currently logs only the event name;
update the HLS listener registered with hls.on(Hls.Events.ERROR, ...) to accept
both parameters (event, data) and log the actual error details from data (e.g.,
data.type, data.details, data.response) instead of the event string, and handle
fatal errors by calling the Hls instance recovery/cleanup methods (e.g.,
hls.recoverMediaError(), hls.startLoad() or hls.destroy()) depending on
data.fatal; modify the callback signature and add branching for data.fatal to
attempt recovery or cleanup accordingly.

---

Nitpick comments:
In `@app/components/global/BlueskyPostEmbed.client.vue`:
- Around line 200-213: The template rendering a VideoPlayer for playlist embeds
omits the component's viewport-based autoplay prop, so the video won't auto-play
when scrolled into view; decide whether autoplay-on-intersection is desired and
if so add the :autoplay="true" prop to the <VideoPlayer> usage (keeping existing
props like controls, muted, loop) to enable the component's intersection-driven
play/pause behavior, otherwise leave as-is to require manual interaction.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aa5c26f3-6d23-47e9-9bee-fbd45cb38d85

📥 Commits

Reviewing files that changed from the base of the PR and between db64da9 and 6bfe7d0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • app/components/VideoPlayer.vue
  • app/components/global/BlueskyPostEmbed.client.vue
  • modules/security-headers.ts
  • package.json

Comment thread app/components/VideoPlayer.vue
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.

1 participant