Class: ActiveVlc::LibVlc::MediaPlayer
- Inherits:
-
Object
- Object
- ActiveVlc::LibVlc::MediaPlayer
- Defined in:
- lib/activevlc/libvlc/media_player.rb
Instance Attribute Summary collapse
-
#media ⇒ Object
Returns the value of attribute media.
-
#ptr ⇒ Object
readonly
Returns the value of attribute ptr.
Instance Method Summary collapse
- #event_manager ⇒ Object
-
#initialize(vlc_or_media) ⇒ MediaPlayer
constructor
A new instance of MediaPlayer.
- #pause ⇒ Object
- #play ⇒ Object
- #playing? ⇒ Boolean
- #state ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(vlc_or_media) ⇒ MediaPlayer
Returns a new instance of MediaPlayer.
15 16 17 18 19 20 21 22 23 |
# File 'lib/activevlc/libvlc/media_player.rb', line 15 def initialize(vlc_or_media) @media = nil if vlc_or_media.is_a?(Media) @media = vlc_or_media @ptr = Api.libvlc_media_player_new_from_media(vlc_or_media.ptr) else @ptr = Api.libvlc_media_player_new(vlc_or_media.ptr) end end |
Instance Attribute Details
#media ⇒ Object
Returns the value of attribute media.
13 14 15 |
# File 'lib/activevlc/libvlc/media_player.rb', line 13 def media @media end |
#ptr ⇒ Object (readonly)
Returns the value of attribute ptr.
13 14 15 |
# File 'lib/activevlc/libvlc/media_player.rb', line 13 def ptr @ptr end |
Instance Method Details
#event_manager ⇒ Object
25 26 27 28 29 |
# File 'lib/activevlc/libvlc/media_player.rb', line 25 def event_manager event_manger = Api.libvlc_media_player_event_manager(@ptr) raise "Unable to get EventManager for MediaPlayer #{@ptr.inspect}" unless event_manger EventManager.new event_manger end |
#pause ⇒ Object
43 44 45 |
# File 'lib/activevlc/libvlc/media_player.rb', line 43 def pause if_media { Api.libvlc_media_player_pause @ptr} end |
#play ⇒ Object
37 38 39 |
# File 'lib/activevlc/libvlc/media_player.rb', line 37 def play if_media { Api.libvlc_media_player_play @ptr } end |
#playing? ⇒ Boolean
47 48 49 |
# File 'lib/activevlc/libvlc/media_player.rb', line 47 def Api. @ptr end |
#state ⇒ Object
51 52 53 |
# File 'lib/activevlc/libvlc/media_player.rb', line 51 def state Api.libvlc_media_player_get_state @ptr end |
#stop ⇒ Object
40 41 42 |
# File 'lib/activevlc/libvlc/media_player.rb', line 40 def stop if_media { Api.libvlc_media_player_stop @ptr } end |