mediaplayer
TODO Write a description here
Installation
-
Add the dependency to your
shard.yml
:dependencies: mediaplayer: github: data-niklas/mediaplayer
-
Run
shards install
Usage
require "mediaplayer"
In the Player module, following classes are exposed:
- Instance
- Media
- MediaList
- MediaPlayer
- Equalizer
The MediaPlayer is either a (VLC) MediaListPlayer or (VLC) MediaPlayer, depending on the selected mode. By default it will be a MediaListPlayer.
Simple Example:
player = Player::MediaPlayer.new
media = Player::Media.new "/home/user/some/path/to/file/or/dir"
player.set media
player.play
sleep 10
player.stop
Event handling:
player.on LibVlc::Event::MediaPlayerEndReached, LibVlc::Callback.new{ |event_data, user_data|
puts "Song finished"
WrappingModule.call_finish_function(event_data, user_data)
}
Due to the callback being passed to the c library, variables cannot be accessed in the callback.
One of the easiest methods to use the callback, is to call a function in a wrapping module with the variables in the callback.
Inside of the called function, other variables of the Module can now be accessed again.
Development
TODO Write development instructions here
Contributing
- Fork it (https://github.com/your-github-user/mediaplayer/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Niklas Loeser - creator and maintainer