-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: admin provider video preview #2463
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
Merged
ascorbic
merged 6 commits into
emdash-cms:main
from
helio-cf:fix/admin-provider-video-preview
Aug 24, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
760e79a
fix(admin): preview streaming provider video in media library
helio-cf 67200e3
test(admin,cloudflare): cover streaming provider media previews
helio-cf ddaa948
fix(admin): read provider media size from meta in library list rows
helio-cf edf7865
Merge branch 'main' into fix/admin-provider-video-preview
ascorbic 5edeb48
Merge branch 'main' into fix/admin-provider-video-preview
helio-cf 8979400
Merge branch 'main' into fix/admin-provider-video-preview
ascorbic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@emdash-cms/admin": patch | ||
| "@emdash-cms/cloudflare": patch | ||
| "emdash": patch | ||
| --- | ||
|
|
||
| Fixes media previews for streaming providers such as Cloudflare Stream. Video from these providers now shows its poster thumbnail in the media library grid and list, plays in the detail panel instead of stalling at 0:00, and reports the file size the provider supplies. Also exports `Media` from `emdash/ui`, so frontends can render provider-backed video and audio that `Image` cannot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
|
|
||
| import { metaPlayback, providerItemToMediaItem } from "../../src/lib/media-utils"; | ||
|
|
||
| const STREAM_HLS = "https://customer-abc123.cloudflarestream.com/UID/manifest/video.m3u8"; | ||
| const STREAM_DASH = "https://customer-abc123.cloudflarestream.com/UID/manifest/video.mpd"; | ||
| const STREAM_POSTER = "https://customer-abc123.cloudflarestream.com/UID/thumbnails/thumbnail.jpg"; | ||
|
|
||
| describe("metaPlayback", () => { | ||
| it("reads the streaming sources Cloudflare Stream reports", () => { | ||
| expect(metaPlayback({ playback: { hls: STREAM_HLS, dash: STREAM_DASH } })).toEqual({ | ||
| hls: STREAM_HLS, | ||
| dash: STREAM_DASH, | ||
| }); | ||
| }); | ||
|
|
||
| it("returns undefined for a plain uploaded file, which is playable directly", () => { | ||
| // This is what keeps locally stored video on the plain `src` path. | ||
| expect(metaPlayback({ size: 1024 })).toBeUndefined(); | ||
| expect(metaPlayback(undefined)).toBeUndefined(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("providerItemToMediaItem", () => { | ||
| it("falls back to meta.size when the provider reports no top-level size", () => { | ||
| // Regression: Stream items displayed "0 B" because only `item.size` was read. | ||
| const result = providerItemToMediaItem("cloudflare-stream", { | ||
| id: "6a4677c7694f6e2e4270540231dd47ff", | ||
| filename: "webinar.mp4", | ||
| mimeType: "video/mp4", | ||
| previewUrl: STREAM_POSTER, | ||
| meta: { size: 75431883, playback: { hls: STREAM_HLS } }, | ||
| } as never); | ||
|
|
||
| expect(result.size).toBe(75431883); | ||
| // `meta` must survive the mapping or the detail panel cannot find playback. | ||
| expect(metaPlayback(result.meta)).toEqual({ hls: STREAM_HLS }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me know if we have something for this already ie zod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small enough tho, im fine with this approach