vlc-rs/README.md

77 lines
2.2 KiB
Markdown
Raw Normal View History

2018-11-06 12:08:38 +00:00
# vlc-rs [![Build Status](https://travis-ci.org/garkimasera/vlc-rs.svg?branch=master)](https://travis-ci.org/garkimasera/vlc-rs)
2021-04-13 18:22:58 +00:00
2015-11-29 01:26:04 +00:00
Rust bindings for libVLC media framework.
2015-11-29 02:29:44 +00:00
## Status
2021-04-13 18:22:58 +00:00
2015-11-29 02:29:44 +00:00
Many missing functions and wrappers.
## Use
2021-04-13 18:22:58 +00:00
2015-11-29 02:29:44 +00:00
Please add the following dependencies to your Cargo.toml.
2018-03-10 05:17:57 +00:00
```Toml
[dependencies]
2018-06-10 11:14:55 +00:00
vlc-rs = "0.3"
2018-03-10 05:17:57 +00:00
```
Or:
2015-11-29 02:29:44 +00:00
```Toml
[dependencies.vlc-rs]
2016-07-03 04:20:50 +00:00
git = "https://github.com/garkimasera/vlc-rs.git"
2015-11-29 02:29:44 +00:00
```
## Example
2021-04-13 18:22:58 +00:00
2016-01-28 11:15:26 +00:00
Play for 10 seconds from a media file.
2021-04-13 18:22:58 +00:00
2015-11-29 02:29:44 +00:00
```Rust
extern crate vlc;
use vlc::{Instance, Media, MediaPlayer};
use std::thread;
fn main() {
// Create an instance
let instance = Instance::new().unwrap();
// Create a media from a file
let md = Media::new_path(&instance, "path_to_a_media_file.ogg").unwrap();
// Create a media player
let mdp = MediaPlayer::new(&instance).unwrap();
mdp.set_media(&md);
// Start playing
mdp.play().unwrap();
// Wait for 10 seconds
2016-01-28 11:15:26 +00:00
thread::sleep(::std::time::Duration::from_secs(10));
2015-11-29 02:29:44 +00:00
}
```
2015-11-29 08:30:19 +00:00
Other examples are in the examples directory.
2021-04-13 18:22:58 +00:00
## Building
### Windows
To build `vlc-rs`, you must either build VLC from source or grab one of the pre-built packages from [videolan.org](https://www.videolan.org/vlc/download-windows.html).
If you're building for `x86_64`, then you should grab the download labelled "Installer for 64bit version".
That installer is actually a self-extracting ZIP archive, so we can extract the contents without installing VLC itself.
If you're building for `x86`, then you should either download labelled "7zip package" or the one labelled "Zip package".
Once you've downloaded your chosen package, you should extract it some place such that its path contains no spaces.
To point `vlc-rs` at your VLC package, you should set an appropriate environment variable:
- `VLC_LIB_DIR`: Directory of the VLC pacakge, any architecture
- `VLC_LIB_DIR_X86` : Directory of the VLC pacakge, `x86`-only
- `VLC_LIB_DIR_X86_64` : Directory of the VLC pacakge, `x86_64`-only
You should also add the package to your `PATH` variable if you intend to run the program.
For distribution of an executable program, you should probably copy over the neccessary DLLs, as well as the `plugins` directory.
2015-11-29 02:29:44 +00:00
## License
2021-04-13 18:22:58 +00:00
2015-11-29 08:30:19 +00:00
MIT (Examples are licensed under CC0)