Skip setting player option when unsupported

This commit is contained in:
Rafostar
2020-09-06 10:34:27 +02:00
parent d8d342a956
commit da652e1ec5

View File

@@ -1,4 +1,5 @@
const { GLib, GObject, Gst, GstPlayer } = imports.gi;
const Debug = imports.clapper_src.debug;
const GSTPLAYER_DEFAULTS = {
position_update_interval: 1000,
@@ -6,6 +7,8 @@ const GSTPLAYER_DEFAULTS = {
user_agent: 'clapper',
};
let { debug } = Debug;
var Player = GObject.registerClass(
class ClapperPlayer extends GstPlayer.Player
{
@@ -37,8 +40,14 @@ class ClapperPlayer extends GstPlayer.Player
let config = this.get_config();
for(let setting of Object.keys(GSTPLAYER_DEFAULTS))
GstPlayer.Player[`config_set_${setting}`](config, opts[setting]);
for(let setting of Object.keys(GSTPLAYER_DEFAULTS)) {
let setOption = GstPlayer.Player[`config_set_${setting}`];
if(!setOption) {
debug(`unsupported option: ${setting}`, 'LEVEL_WARNING');
continue;
}
setOption(config, opts[setting]);
}
this.set_config(config);