From 19e1a20bf764d48fa75b01bc4bd125456ed294d9 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Fri, 30 Oct 2020 22:51:30 +0100 Subject: [PATCH] Start fullscreen playback after toplevel state is changed --- clapper_src/player.js | 25 ++++++++++++++----------- clapper_src/widget.js | 4 ++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/clapper_src/player.js b/clapper_src/player.js index a3afeb07..031459d5 100644 --- a/clapper_src/player.js +++ b/clapper_src/player.js @@ -14,6 +14,7 @@ class ClapperPlayer extends PlayerBase this.state = GstPlayer.PlayerState.STOPPED; this.cursorInPlayer = false; + this.playOnFullscreen = false; this.is_local_file = false; this.seek_done = true; this.dragAllowed = false; @@ -345,22 +346,24 @@ class ClapperPlayer extends PlayerBase _onUriLoaded(player, uri) { + debug(`URI loaded: ${uri}`); + if(!this.doneStartup) { - if(this.settings.get_boolean('fullscreen-auto')) { - let root = player.widget.get_root(); - if(root) { - let clapperWidget = root.get_child(); - if(!clapperWidget.fullscreenMode) - root.fullscreen(); - } - } + this.doneStartup = true; if(this.settings.get_string('volume-initial') === 'custom') this.set_volume(this.settings.get_int('volume-value') / 100); - } - this.doneStartup = true; + if(this.settings.get_boolean('fullscreen-auto')) { + let root = player.widget.get_root(); + let clapperWidget = root.get_child(); + if(!clapperWidget.fullscreenMode) { + this.playOnFullscreen = true; + root.fullscreen(); + return; + } + } + } this.play(); - debug(`URI loaded: ${uri}`); } _onPlayerWarning(player, error) diff --git a/clapper_src/widget.js b/clapper_src/widget.js index 87eb0134..33d4b710 100644 --- a/clapper_src/widget.js +++ b/clapper_src/widget.js @@ -384,6 +384,10 @@ var Widget = GObject.registerClass({ this.showControls(isFullscreen); this.player.widget.grab_focus(); + if(this.player.playOnFullscreen && isFullscreen) { + this.player.playOnFullscreen = false; + this.player.play(); + } this.emit('fullscreen-changed', isFullscreen); debug(`interface in fullscreen mode: ${isFullscreen}`); }