Class: Sportsflix::Players::VLC::Client
- Inherits:
-
Object
- Object
- Sportsflix::Players::VLC::Client
- Defined in:
- lib/sportsflix/players/vlc.rb
Constant Summary collapse
- ALTERNATIVE_PLAYER_PATHS =
[ 'vlc', '/Applications/VLC.app/Contents/MacOS/VLC', '/c/Program Files/VideoLAN/VLC/vlc.exe', '/mnt/c/Program Files/VideoLAN/VLC/vlc.exe' ]
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #start(stream) ⇒ Object
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sportsflix/players/vlc.rb', line 17 def initialize() @verbose = [:verbose] @server_only = ['server-only'] @video_player_path = ['video-player-path'] @proxy_delay = ['proxy-delay'] @executor = Sportsflix::Utils::Executor.new() @stream_proxies = { :default => Sportsflix::Players::Proxies::Default::Client.new(), :acestream => Sportsflix::Players::Proxies::Acestream::Client.new() } end |
Instance Method Details
#start(stream) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sportsflix/players/vlc.rb', line 30 def start(stream) proxy = @stream_proxies[stream[:proxy]] proxy.stop proxy.start # Waiting for proxy to start puts "Waiting for proxy to start (#{@proxy_delay})..." sleep(@proxy_delay) stream_final_url = proxy.url(stream[:uri]) puts "Playing #{stream_final_url}" unless @server_only video_player = find_video_player @executor.run %{#{video_player} #{stream_final_url}} proxy.stop end end |