Rust bindings for Plyr.Please check the official plyr page for more details.
Specify it as a dependency in Cargo.toml
toml
[dependencies]
plyr = { git = "https://github.com/deepgreenAN/plyr-rs"}
See the official page or simple example for how to write in html or rsx and css.
Give the css selector as an argument as follows, ```rust use plyr::Plyr;
let player = Plyr::new("#player");
or `web_sys::HtmlElement`.
rust
use glooutils::document;
use plyr::Plyr;
use wasmbindgen::JsCast;
use web_sys::HtmlElement;
let playerelement = document().queryselector("#player").unwrap().unwrap();
let player = Plyr::newwithhtmlelement(&playerelement.unchecked_into::
If you want to pass options to the constructor, modify the features.
toml
[dependencies]
plyr = { git = "https://github.com/deepgreenAN/plyr-rs", features = ["options"]}
```rust use plyr::options::PlyrOptions; use plyr::Plyr;
let player = Plyr::newwith_options("#player", &PlyrOptions::builder().duration(50.0).build()); ```
You can use the cdn for reducing the bundle size of js snippets. ```html
```
toml
[dependencies]
plyr = { git = "https://github.com/deepgreenAN/plyr-rs", features = ["cdn"]}
Check examples directory for other examples.