Crates.io | plyr |
lib.rs | plyr |
version | 0.0.4 |
source | src |
created_at | 2023-01-24 11:53:32.912006 |
updated_at | 2023-02-15 15:14:28.592885 |
description | Rust bindings for plyr |
homepage | |
repository | https://github.com/deepgreenAN/plyr-rs |
max_upload_size | |
id | 766619 |
size | 439,936 |
Rust bindings for Plyr.Please check the official plyr page for more details.
Specify it as a dependency in Cargo.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,
use plyr::Plyr;
let player = Plyr::new("#player");
or web_sys::HtmlElement
.
use gloo_utils::document;
use plyr::Plyr;
use wasm_bindgen::JsCast;
use web_sys::HtmlElement;
let player_element = document().query_selector("#player").unwrap().unwrap();
let player = Plyr::new_with_html_element(&player_element.unchecked_into::<HtmlElement>());
If you want to pass options to the constructor, modify the features.
[dependencies]
plyr = { git = "https://github.com/deepgreenAN/plyr-rs", features = ["options"]}
use plyr::options::PlyrOptions;
use plyr::Plyr;
let _player = Plyr::new_with_options("#player", &PlyrOptions::builder().duration(50.0).build());
You can use the cdn for reducing the bundle size of js snippets.
<script src="https://cdn.plyr.io/3.7.3/plyr.polyfilled.js"></script>
[dependencies]
plyr = { git = "https://github.com/deepgreenAN/plyr-rs", features = ["cdn"]}
Check examples directory for other examples.