playbin3: current-uri returning None
when first setting the uri in a playbin3 and getting the property current-uri it works fine but after changing the uri then trying to get the current-uri again it returns nothing. the code below displays this
Code
use gst::prelude::*;
fn example_main() {
gst::init().unwrap();
let uri =
"https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
let uri2 = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
// Create a new playbin element, and tell it what uri to play back.
let playbin = gst::ElementFactory::make("playbin3")
.property("uri", uri)
.build()
.unwrap();
playbin.set_property("instant-uri", true);
// The playbin element itself is a playbin, so it can be used as one, despite being
// created from an element factory.
let bus = playbin.bus().unwrap();
playbin
.set_state(gst::State::Playing)
.expect("Unable to set the pipeline to the `Playing` state");
std::thread::spawn(move || {
for msg in bus.iter_timed(gst::ClockTime::NONE) {
use gst::MessageView;
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {
println!(
"Error from {:?}: {} ({:?})",
err.src().map(|s| s.path_string()),
err.error(),
err.debug()
);
break;
}
_ => (),
}
}
});
{
let current_uri: Option<String> = playbin.property("current-uri");
println!("Current URI: {:?}", current_uri);
}
std::thread::sleep(std::time::Duration::from_secs(10));
playbin.set_property("uri", uri2);
std::thread::sleep(std::time::Duration::from_secs(5));
{
let current_uri: Option<String> = playbin.property("current-uri");
println!("Current URI: {:?}", current_uri);
}
std::thread::sleep(std::time::Duration::from_secs(5));
playbin
.set_state(gst::State::Null)
.expect("Unable to set the pipeline to the `Playing` state");
}
fn main() {
// tutorials_common::run is only required to set up the application environment on macOS
// (but not necessary in normal Cocoa applications where this is set up automatically)
example_main();
}
Edited by Sebastian Dröge