update readme

This commit is contained in:
jazzfool 2024-09-21 13:26:38 +10:00
parent 61b083929e
commit f649ec93da
2 changed files with 8 additions and 15 deletions

2
Cargo.lock generated
View file

@ -1784,7 +1784,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_video_player" name = "iced_video_player"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"glib", "glib",
"gstreamer", "gstreamer",

View file

@ -27,32 +27,25 @@ See the "minimal" example for a demonstration on how you could implement pausing
```rust ```rust
use iced_video_player::{Video, VideoPlayer}; use iced_video_player::{Video, VideoPlayer};
use iced::{Sandbox, Element};
fn main() { fn main() -> iced::Result {
App::run(Default::default()); iced::run("Video Player", (), App::view)
} }
struct App { struct App {
video: Video, video: Video,
} }
impl Sandbox for App { impl Default for App {
type Message = (); fn default() -> Self {
fn new() -> Self {
App { App {
video: Video::new(&url::Url::parse("file:///C:/my_video.mp4").unwrap()).unwrap(), video: Video::new(&url::Url::parse("file:///C:/my_video.mp4").unwrap()).unwrap(),
} }
} }
}
fn title(&self) -> String { impl App {
String::from("Video Player") fn view(&self) -> iced::Element<()> {
}
fn update(&mut self, _message: ()) {}
fn view(&mut self) -> Element<()> {
VideoPlayer::new(&self.video).into() VideoPlayer::new(&self.video).into()
} }
} }