PlayerWidget: Set a custom config for the gst Player.

This commit is contained in:
Jordan Petridis 2018-06-14 09:24:24 +03:00
parent b20ea22eaf
commit 50c70e06b2
2 changed files with 11 additions and 3 deletions

View File

@ -81,7 +81,9 @@ pub use models::{Episode, EpisodeWidgetQuery, Podcast, PodcastCoverQuery, Source
// Set the user agent, See #53 for more
// Keep this in sync with Tor-browser releases
const USER_AGENT: &str = "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0";
/// The user-agent to be used for all the requests.
/// It originates from the Tor-browser UA.
pub const USER_AGENT: &str = "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0";
/// [XDG Base Direcotory](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) Paths.
#[allow(missing_debug_implementations)]

View File

@ -11,7 +11,7 @@ use gtk::prelude::*;
use failure::Error;
use hammond_data::dbqueries;
use hammond_data::{dbqueries, USER_AGENTR};
use hammond_data::{EpisodeWidgetQuery, PodcastCoverQuery};
use utils::set_image_from_path;
@ -98,8 +98,14 @@ pub struct PlayerWidget {
impl Default for PlayerWidget {
fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/Hammond/gtk/player_toolbar.ui");
let player = gst_player::Player::new(None, None);
let mut config = player.get_config();
config.set_user_agent(USER_AGENT);
config.set_position_update_interval(250);
player.set_config(config).unwrap();
let builder = gtk::Builder::new_from_resource("/org/gnome/Hammond/gtk/player_toolbar.ui");
let action_bar = builder.get_object("action_bar").unwrap();
let buttons = builder.get_object("buttons").unwrap();