Module: Speak
- Defined in:
- lib/speak.rb,
lib/speak/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.play(uri) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/speak.rb', line 5 def self.play(uri) pipeline = Gst::ElementFactory.make('playbin') pipeline.uri = uri loop = GLib::MainLoop.new(nil, false) # listen to playback events bus = pipeline.bus bus.add_watch do |bus, | case .type when Gst::Message::EOS loop.quit when Gst::Message::ERROR puts .parse loop.quit end true end # start playing pipeline.play begin loop.run rescue Interrupt ensure pipeline.stop end end |