module MMPlayer::Instructions::Player
Instructions
dealing with the MPlayer
Private Class Methods
included(base)
click to toggle source
Add delegators to local player methods
# File lib/mmplayer/instructions/player.rb, line 28 def self.included(base) base.send(:extend, Forwardable) base.send(:def_delegators, :@player, :active?, :play) end
Public Instance Methods
on_end_of_file(&callback)
click to toggle source
Assign a callback for when a file finishes playback @param [Proc] callback The callback to execute when a file finishes playback @return [Hash]
# File lib/mmplayer/instructions/player.rb, line 19 def on_end_of_file(&callback) @player.add_end_of_file_callback(&callback) end
Also aliased as: end_of_file, eof
on_progress(&callback)
click to toggle source
Assign a callback for updating progress @param [Proc] callback The callback to execute when progress is updated @return [Hash]
# File lib/mmplayer/instructions/player.rb, line 11 def on_progress(&callback) @player.add_progress_callback(&callback) end
Also aliased as: progress
Private Instance Methods
method_missing(method, *args, &block)
click to toggle source
Add all of the MPlayer::Slave methods to the context as instructions
Calls superclass method
# File lib/mmplayer/instructions/player.rb, line 34 def method_missing(method, *args, &block) if @player.mplayer_respond_to?(method) @player.mplayer_send(method, *args, &block) else super end end
respond_to_missing?(method, include_private = false)
click to toggle source
Add all of the MPlayer::Slave methods to the context as instructions
Calls superclass method
# File lib/mmplayer/instructions/player.rb, line 43 def respond_to_missing?(method, include_private = false) super || @player.mplayer_respond_to?(method) end