mediaplayer

High level library, which provides a mediaplayer, using vlc bindings

mediaplayer

TODO: Write a description here

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      mediaplayer:
        github: data-niklas/mediaplayer
    
  2. 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

  1. Fork it (https://github.com/your-github-user/mediaplayer/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

mediaplayer

Owner
Statistic
  • 0
  • 0
  • 0
  • 1
  • 1
  • over 4 years ago
  • March 18, 2020
License

MIT License

Links
Synced at

Sun, 17 Nov 2024 15:39:00 GMT

Languages