'python3 gstreamer 1.0 uri becomes none

Is this a bug or expected behavior? The playbin's uri becomes None after I execute pipeline.set_state(gst.State.PLAYING)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')

from gi.repository import GObject, Gtk
from gi.repository import Gst as gst
from sys import exit

GObject.threads_init()
gst.init(None)

# Create the pipeline for our elements.

pipeline = gst.Pipeline()
# Create the elements for our project.

playbin = gst.ElementFactory.make('playbin', None)

uri = "file:///home/erm/disk2/acer-home/dwhelper/01%20some%20times.mp3"
playbin.set_property('uri', uri)
print("AFTER SET playbin.props.uri:", playbin.props.uri)
print("AFTER SET playbin.get_property('uri'):", playbin.get_property('uri'))
#
pipeline.add(playbin)

if (not pipeline or not playbin):
    print('Not all elements could be created.')
    exit(-1)

pipeline.set_state(gst.State.PLAYING)
# Becomes None
print("AFTER SET STATE playbin.props.uri:", playbin.props.uri)
print("AFTER SET STATE playbin.get_property('uri'):", playbin.get_property('uri'))

bus = pipeline.get_bus()

Gtk.main()

Output

AFTER SET playbin.props.uri: file:///home/erm/disk2/acer-home/dwhelper/01%20some%20times.mp3
AFTER SET playbin.get_property('uri'): file:///home/erm/disk2/acer-home/dwhelper/01%20some%20times.mp3
AFTER SET STATE playbin.props.uri: None
AFTER SET STATE playbin.get_property('uri'): None


Solution 1:[1]

Instead or uri use current-uri. See the current-uri documentation for more.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kyle McDonald