{"id":31068678,"url":"https://github.com/cijiugechu/gpui-video-player","last_synced_at":"2025-09-15T21:59:08.310Z","repository":{"id":313813467,"uuid":"1051835129","full_name":"cijiugechu/gpui-video-player","owner":"cijiugechu","description":"Video player for gpui","archived":false,"fork":false,"pushed_at":"2025-09-08T15:24:47.000Z","size":53874,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-08T17:29:43.504Z","etag":null,"topics":["gpui","video","video-player"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cijiugechu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-06T20:21:59.000Z","updated_at":"2025-09-08T17:01:37.000Z","dependencies_parsed_at":"2025-09-08T17:39:57.682Z","dependency_job_id":null,"html_url":"https://github.com/cijiugechu/gpui-video-player","commit_stats":null,"previous_names":["cijiugechu/gpui-video-player"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cijiugechu/gpui-video-player","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cijiugechu%2Fgpui-video-player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cijiugechu%2Fgpui-video-player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cijiugechu%2Fgpui-video-player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cijiugechu%2Fgpui-video-player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cijiugechu","download_url":"https://codeload.github.com/cijiugechu/gpui-video-player/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cijiugechu%2Fgpui-video-player/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275327137,"owners_count":25445050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gpui","video","video-player"],"created_at":"2025-09-15T21:59:05.216Z","updated_at":"2025-09-15T21:59:08.303Z","avatar_url":"https://github.com/cijiugechu.png","language":"Rust","funding_links":[],"categories":["Libraries"],"sub_categories":["Demos \u0026 Examples"],"readme":"# `gpui-video-player`\n\nA video player library for [gpui](https://github.com/zed-industries/zed/tree/main/crates/gpui) applications, built on top of GStreamer. This library provides efficient video playback with hardware-accelerated rendering on supported platforms.\n\n![screenshot](./assets/screenshot.png)\n\n## Installation\n\n### GStreamer Dependencies\n\nThis library requires GStreamer and its plugins to be installed on your system. Please refer to the [GStreamer Rust bindings installation guide](https://github.com/sdroege/gstreamer-rs?tab=readme-ov-file#installation) for detailed instructions.\n\n**Minimum Requirements:**\n- GStreamer 1.14+\n- gst-plugins-base 1.14+\n- gst-plugins-good (recommended)\n- gst-plugins-bad (recommended for additional codec support)\n\n### Adding to Your Project\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\ngpui-video-player = { git = \"https://github.com/cijiugechu/gpui-video-player.git\" }\n```\n\n**Note:** This library depends on GPUI, which must be available in your project. The current version requires GPUI from the Zed repository.\n\n## Usage\n\n### Basic Video Playback\n\n```rust\nuse gpui::{App, Application, Context, Render, Window, WindowOptions, div, prelude::*};\nuse gpui_video_player::{Video, video};\nuse std::path::PathBuf;\nuse url::Url;\n\nstruct VideoPlayer {\n    video: Video,\n}\n\nimpl Render for VideoPlayer {\n    fn render(\u0026mut self, _window: \u0026mut Window, _cx: \u0026mut Context\u003cSelf\u003e) -\u003e impl IntoElement {\n        div()\n            .size_full()\n            .flex()\n            .items_center()\n            .justify_center()\n            .child(\n                video(self.video.clone())\n                    .id(\"main-video\")\n                    .buffer_capacity(30), // Buffer up to 30 frames\n            )\n    }\n}\n\nfn main() {\n    env_logger::init();\n    Application::new().run(|cx: \u0026mut App| {\n        let uri = Url::from_file_path(\n            PathBuf::from(\"./path/to/your/video.mp4\"),\n        ).expect(\"invalid file path\");\n\n        cx.open_window(\n            WindowOptions {\n                focus: true,\n                ..Default::default()\n            },\n            |_, cx| {\n                let video = Video::new(\u0026uri).expect(\"failed to create video\");\n                cx.new(|_| VideoPlayer { video })\n            },\n        ).unwrap();\n        cx.activate(true);\n    });\n}\n```\n\n### Video Controls\n\n```rust\nuse gpui_video_player::Video;\nuse std::time::Duration;\n\n// Playback control\nvideo.set_paused(true);  // Pause\nvideo.set_paused(false); // Resume\n\n// Seeking\nvideo.seek(Duration::from_secs(30), false)?; // Seek to 30 seconds\n\n// Volume control\nvideo.set_volume(0.5); // 50% volume\nvideo.set_muted(true); // Mute\n\n// Speed control\nvideo.set_speed(2.0)?; // 2x speed\n\n// Display size\nvideo.set_display_width(Some(800)); // Override width\nvideo.set_display_height(Some(600)); // Override height\n```\n\n### Advanced Configuration\n\n```rust\nuse gpui_video_player::{Video, VideoOptions, video};\n\nlet options = VideoOptions {\n    frame_buffer_capacity: Some(10), // Buffer 10 frames\n    looping: Some(true),            // Enable looping\n    speed: Some(1.5),               // 1.5x speed\n};\n\nlet video = Video::new_with_options(\u0026uri, options)?;\n```\n\n### Custom Video Element\n\n```rust\nuse gpui_video_player::{VideoElement, video};\n\nlet video_element = video(my_video)\n    .id(\"custom-video\")\n    .size(px(640.0), px(480.0))  // Set display size\n    .buffer_capacity(5);         // Buffer 5 frames\n```\n\n## API Reference\n\n### Video\n\nThe main video player struct with methods for:\n\n- **Playback Control**: `set_paused()`, `paused()`\n- **Seeking**: `seek()`, `position()`, `duration()`\n- **Audio**: `set_volume()`, `volume()`, `set_muted()`, `muted()`\n- **Speed**: `set_speed()`, `speed()`\n- **Display**: `display_size()`, `set_display_size()`\n- **Frame Access**: `current_frame_data()`, `take_frame_ready()`\n\n### VideoElement\n\nGPUI element for rendering video with:\n\n- **Sizing**: `size()`, `width()`, `height()`\n- **Buffering**: `buffer_capacity()`\n- **Identification**: `id()`\n\n### Position\n\nTime or frame-based positioning:\n\n```rust\nuse gpui_video_player::Position;\nuse std::time::Duration;\n\nlet time_pos = Position::Time(Duration::from_secs(10));\nlet frame_pos = Position::Frame(300);\n```\n\n## Examples\n\nRun the included examples to see the library in action:\n\n```bash\n# Basic video player\ncargo run --example video_player\n\n# Video player with controls\ncargo run --example with_controls\n```\n\n## Platform Notes\n\n### macOS\n- Uses `CVPixelBuffer` for hardware-accelerated rendering when possible\n- Falls back to software rendering via GPUI sprite atlas\n\n### Linux/Windows\n- Uses optimized software rendering via GPUI sprite atlas\n- Supports various GStreamer backends\n\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues and pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Credits\n\nThis project is inspired by and has referenced code from [iced_video_player](https://github.com/jazzfool/iced_video_player) by [@jazzfool](https://github.com/jazzfool).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcijiugechu%2Fgpui-video-player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcijiugechu%2Fgpui-video-player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcijiugechu%2Fgpui-video-player/lists"}