Class: ActiveVlc::LibVlc::MediaListPlayer

Inherits:
Object
  • Object
show all
Defined in:
lib/activevlc/libvlc/media_list_player.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr, media_list = nil, media_player = nil) ⇒ MediaListPlayer

Returns a new instance of MediaListPlayer.



14
15
16
17
18
19
20
21
# File 'lib/activevlc/libvlc/media_list_player.rb', line 14

def initialize(ptr, media_list = nil, media_player = nil)
  @ptr = MediaListPlayerPtr.new(ptr)
  @list = media_list
  @player = media_player

  self.media_list = media_list if media_list
  self.media_player = media_player if media_player
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



12
13
14
# File 'lib/activevlc/libvlc/media_list_player.rb', line 12

def list
  @list
end

#playerObject (readonly)

Returns the value of attribute player.



12
13
14
# File 'lib/activevlc/libvlc/media_list_player.rb', line 12

def player
  @player
end

#ptrObject (readonly)

Returns the value of attribute ptr.



12
13
14
# File 'lib/activevlc/libvlc/media_list_player.rb', line 12

def ptr
  @ptr
end

Instance Method Details

#event_managerObject



32
33
34
# File 'lib/activevlc/libvlc/media_list_player.rb', line 32

def event_manager
  EventManager.new Api.libvlc_media_list_player_event_manager(@ptr)
end

#media_list=(list) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/activevlc/libvlc/media_list_player.rb', line 23

def media_list=(list)
  if list and list.is_a?(MediaList)
    @list = list
    Api.libvlc_media_list_player_set_media_list(@ptr, list.ptr)
  else
    raise "You must provide a valid MediaList"
  end
end

#media_player=(player) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/activevlc/libvlc/media_list_player.rb', line 40

def media_player=(player)
  if player.is_a?(MediaPlayer) and not playing?
    raise "Player already has a media" if player.media
    @player = player
    Api.libvlc_media_list_player_set_media_player(@ptr, player.ptr)
  end
end

#nextObject



57
58
59
# File 'lib/activevlc/libvlc/media_list_player.rb', line 57

def next
  Api.libvlc_media_list_player_next(@ptr)
end

#pauseObject



51
52
53
# File 'lib/activevlc/libvlc/media_list_player.rb', line 51

def pause
  Api.libvlc_media_list_player_pause(@ptr)
end

#playObject



48
49
50
# File 'lib/activevlc/libvlc/media_list_player.rb', line 48

def play
  Api.libvlc_media_list_player_play(@ptr)
end

#playing?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/activevlc/libvlc/media_list_player.rb', line 36

def playing?
  Api.libvlc_media_list_player_is_playing(@ptr) != 0
end

#previousObject



60
61
62
# File 'lib/activevlc/libvlc/media_list_player.rb', line 60

def previous
  Api.libvlc_media_list_player_previous(@ptr)
end

#stopObject



54
55
56
# File 'lib/activevlc/libvlc/media_list_player.rb', line 54

def stop
  Api.libvlc_media_list_player_stop(@ptr)
end