Created
January 21, 2013 20:48
-
-
Save JiriChara/4589209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventmachine' | |
module Mplayer | |
def receive_data(data) | |
end | |
end | |
class Player | |
def initialize | |
@io = EM.popen("mplayer -noconsolecontrols -nolirc -idle -slave", Mplayer) | |
end | |
def play(track) | |
@io.send_data("loadfile \"#{track}\" 0\n") | |
end | |
end | |
EM.run do | |
Player.new.play("/path/to/some/song.mp3") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment