Hi everyone!
I have a very strange behaviour with gstreamer. Under certain
circonstances, the play method of a playbin object freeze my Gtk/Gst
applycation. This is an example of a freezing code.
======================================================
#!/usr/bin/env ruby
encoding: UTF-8
#gst-launch playbin
uri=“http://mp3.live.tv-radio.com/centpourcent/all/centpourcent-128k.mp3”
require ‘gtk2’
require ‘gst’
class Player
def initialize
@playbin=Gst::ElementFactory.make(‘playbin’)
@playbin.ready
end
def stop
@playbin.stop
end
def play
@playbin.uri=‘http://mp3.live.tv-radio.com/centpourcent/all/centpourcent-128k.mp3’
#@playbin.uri=‘file:///home/instable/Musique/01 - Blue Bird.mp3’
p “Going to play…”
@playbin.play
p “Playing.”
end
end
class Gui
def initialize(player)
@player=player
@bstop=Gtk::Button.new(‘Stop’)
@bstop.signal_connect(‘clicked’){@player.stop}
@bplay=Gtk::Button.new(‘Play’)
@bplay.signal_connect(‘clicked’){@player.play}
@box=Gtk::HBox.new
@box.pack_start(@bstop)
@box.pack_start(@bplay)
@window=Gtk::Window.new
@window.add(@box)
@window.show_all
@window.signal_connect(“delete_event”){Gtk_quit; true}
#@player.play
end
end
player=Player.new
gui=Gui.new(player)
#player.play
Gtk.main
Did it also freeze the program on clicking the play button on your
machine ?
I will try to explain the circonstances needed for a freeze.
The uri need to a webradio (maybe not all webradios freezes). No
freeze with loacal files.
The play method must be called from a block. No freeze if it is called
from the main code or within the Gui#initialize method.
If the uri was all ready played, the play method from a block do not
freeze the programm. (If I call player.play from main code, I can use
the stop and then the play button without freezing the programm.
Am I doing something wrong ?
Vincent