plyr

Crates.ioplyr
lib.rsplyr
version0.0.4
sourcesrc
created_at2023-01-24 11:53:32.912006
updated_at2023-02-15 15:14:28.592885
descriptionRust bindings for plyr
homepage
repositoryhttps://github.com/deepgreenAN/plyr-rs
max_upload_size
id766619
size439,936
(deepgreenAN)

documentation

README

Plyr-rs

crates.io docs.rs

Rust bindings for Plyr.Please check the official plyr page for more details.

Installation

Specify it as a dependency in Cargo.toml

[dependencies]
plyr = { git = "https://github.com/deepgreenAN/plyr-rs"}

Usage

Html or Rsx and CSS

See the official page or simple example for how to write in html or rsx and css.

Rust

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());

CDN

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"]}

Examples

Check examples directory for other examples.

Commit count: 34

cargo fmt