'Initialize a player.
If a finished_callback is provided, it is called every time a
track started with play_file finishes.
Once the player has been created, call run() to begin the main
runloop in a separate thread.'

def __init__(self, finished_callback=None):

    self.player = Gst.ElementFactory.make('playbin', 'player')
    if (self.player is None):
        raise ui.UserError('Could    not    create    playbin')
    fakesink = Gst.ElementFactory.make('fakesink', 'fakesink')
    if (fakesink is None):
        raise ui.UserError('Could    not    create    fakesink')
    self.player.set_property('video-sink', fakesink)
    bus = self.player.get_bus()
    bus.add_signal_watch()
    bus.connect('message', self._handle_message)
    self.playing = False
    self.finished_callback = finished_callback
    self.cached_time = None
    self._volume = 1.0
