Testing streaming from fifo... choppy audio playback right now

This commit is contained in:
Matthieu Grieger 2014-11-25 16:43:08 -08:00
parent cdccf9a8eb
commit f8ff6ba92a
3 changed files with 9 additions and 0 deletions

View file

@ -3,3 +3,4 @@ source "https://rubygems.org"
gem "mumble-ruby"
gem "spotify"
gem "mkfifo"

View file

@ -13,6 +13,7 @@ GEM
json (1.8.1)
libspotify (12.1.51.4)
minitest (5.4.3)
mkfifo (0.0.1)
mumble-ruby (1.1.2)
activesupport
hashie
@ -36,5 +37,6 @@ PLATFORMS
ruby
DEPENDENCIES
mkfifo
mumble-ruby
spotify

View file

@ -3,6 +3,7 @@
# mumbledj.rb
require "mumble-ruby"
require "mkfifo"
require_relative "config"
require_relative "song_queue"
@ -110,6 +111,11 @@ class MumbleDJ
else
@client.text_user(@sender, NO_PERMISSION_MSG)
end
when 'test'
File.mkfifo('/tmp/audio_stream.fifo')
`youtube-dl --output audio --write-info-json --quiet --format bestaudio https://www.youtube.com/watch?v=5xfEr2Oxdys`
spawn 'ffmpeg -y -i audio -f s16le -acodec pcm_s16le -ar 24000 -loglevel quiet /tmp/audio_stream.fifo'
@client.player.stream_named_pipe('/tmp/audio_stream.fifo')
else
@client.text_user(@sender, INVALID_COMMAND_MSG)
end