Files
Ely-GPUI-Components/examples/gallery/pages/media/mod.rs
T
ZacharyZhang-NYandClaude Opus 5.5 d0175edb7b T26c Media: video
Scrubber shows what has loaded, what has played and its chapters, names
the time under the pointer, seeks by press and gpui's drag, and steps by
the slider's keys; over_media lights it for a dark layer. VideoPlayer
shows the host's frame in its shape with a caption and a control bar over
it: the scrubber, play, the time, speed, captions, picture in picture and
full screen, each only with its handler; the bar rests after a still
pointer while it plays, on one wake from the executor's timer. Keys:
Space and K, J and L, the arrows, C and F. VideoThumbnailStrip lays frames
along the length under a playhead with a trim whose handles drag and whose
ends I and O set. SubtitleEditor edits cues in place: times as mm:ss.mmm,
kept in order, a time that does not read kept out with the reason shown.

InlineEdit is a Tab stop with the ring; it hands focus back after Enter or
Escape and keeps its text on Enter's release. overlays::media_button is
shared by the lightbox and the player's bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 17:07:26 -04:00

86 lines
2.6 KiB
Rust

mod edit;
mod images;
mod video;
use gpui::{AnyElement, App, IntoElement, ParentElement, Window, div};
use super::Page;
use crate::script::Step;
pub const PAGE: Page = Page {
number: 26,
slug: "media",
title: "Media",
summary: "Pictures, video and sound: looking closely, cropping and marking up, playing, and the controls and devices around them.",
render,
script: SCRIPT,
};
const SCRIPT: &[Step] = &[
Step::DownAt("media-viewer", 320.0, 240.0),
Step::UpAt("media-viewer", 320.0, 240.0),
Step::Key("="),
Step::Key("="),
Step::Wait(300),
Step::Shot("zoomed"),
Step::Key("r"),
Step::Wait(500),
Step::Shot("turned"),
Step::DownAt("media-thumbs", 237.0, 50.0),
Step::UpAt("media-thumbs", 237.0, 50.0),
Step::Wait(500),
Step::Shot("lightbox"),
Step::Key("escape"),
Step::Wait(300),
Step::DownAt("media-cropper", 458.0, 317.0),
Step::DragTo("media-cropper", 400.0, 280.0),
Step::UpAt("media-cropper", 400.0, 280.0),
Step::Wait(200),
Step::Shot("cropped"),
Step::DownAt("media-annotator", 500.0, 80.0),
Step::UpAt("media-annotator", 500.0, 80.0),
Step::Key("v"),
Step::DownAt("media-annotator", 168.0, 310.0),
Step::UpAt("media-annotator", 168.0, 310.0),
Step::Wait(200),
Step::Shot("chosen"),
Step::Key("b"),
Step::DownAt("media-annotator", 60.0, 90.0),
Step::DragTo("media-annotator", 200.0, 200.0),
Step::UpAt("media-annotator", 200.0, 200.0),
Step::Wait(200),
Step::Shot("marked"),
Step::DownAt("media-upload", 388.0, 307.0),
Step::UpAt("media-upload", 388.0, 307.0),
Step::Wait(300),
Step::Shot("emptied"),
Step::HoverAt("media-scrubber", 320.0, 31.0),
Step::Wait(200),
Step::Shot("scrub-tip"),
Step::DownAt("media-strip", 467.0, 25.0),
Step::DragTo("media-strip", 560.0, 25.0),
Step::UpAt("media-strip", 560.0, 25.0),
Step::Wait(200),
Step::Shot("trimmed"),
Step::DownAt("media-subtitles", 80.0, 142.0),
Step::UpAt("media-subtitles", 80.0, 142.0),
Step::Type("00:20.000"),
Step::Key("enter"),
Step::Wait(300),
Step::Shot("retimed"),
];
fn render(window: &mut Window, cx: &mut App) -> AnyElement {
div()
.child(images::viewer(cx))
.child(images::thumbnails(window, cx))
.child(edit::cropper(window, cx))
.child(edit::upload(window, cx))
.child(edit::annotator(window, cx))
.child(video::video(window, cx))
.child(video::scrubber(window, cx))
.child(video::strip(window, cx))
.child(video::subtitles(window, cx))
.into_any_element()
}