use gstreamer_player as gst_player;
use gtk::glib;

pub fn create_player(uri: &str) -> gst_player::Player {
    let player = gst_player::Player::new(None, None);
    player.set_uri(Some(uri));
    player.connect_end_of_stream(glib::clone!(@weak player => move |_| {
        player.seek(gstreamer::ClockTime::from_seconds(0));
    }));
    player.connect_error(|_, err| eprintln!("[ahfail] GStreamer error: {}", err));
    player
}
