Add option to close player after playback

This commit is contained in:
Rafostar
2020-12-03 11:04:37 +01:00
parent 44e04d7e60
commit 7a66da1fed
4 changed files with 8 additions and 3 deletions

View File

@@ -345,12 +345,13 @@ class ClapperPlayer extends PlayerBase
_onStreamEnded(player) _onStreamEnded(player)
{ {
debug('stream ended');
this._trackId++; this._trackId++;
if(this._trackId < this._playlist.length) if(this._trackId < this._playlist.length)
this.set_media(this._playlist[this._trackId]); this.set_media(this._playlist[this._trackId]);
else else if(settings.get_boolean('close-auto'))
this.stop(); this._onCloseRequest(this.widget.get_root());
} }
_onUriLoaded(player, uri) _onUriLoaded(player, uri)

View File

@@ -13,6 +13,7 @@ class ClapperGeneralPage extends PrefsBase.Grid
this.addTitle('Startup'); this.addTitle('Startup');
this.addCheckButton('Auto enter fullscreen', 'fullscreen-auto'); this.addCheckButton('Auto enter fullscreen', 'fullscreen-auto');
this.addCheckButton('Close after playback', 'close-auto');
this.addTitle('Volume'); this.addTitle('Volume');
let comboBox = this.addComboBoxText('Initial value', [ let comboBox = this.addComboBoxText('Initial value', [

View File

@@ -405,7 +405,6 @@ var Widget = GObject.registerClass({
player.disconnect(this.mediaInfoSignal); player.disconnect(this.mediaInfoSignal);
this.mediaInfoSignal = null; this.mediaInfoSignal = null;
} }
this.controls.togglePlayButton.setPrimaryIcon();
break; break;
case GstPlayer.PlayerState.PAUSED: case GstPlayer.PlayerState.PAUSED:
debug('player state changed to: PAUSED'); debug('player state changed to: PAUSED');

View File

@@ -6,6 +6,10 @@
<default>false</default> <default>false</default>
<summary>Automatically enter fullscreen when first file is loaded</summary> <summary>Automatically enter fullscreen when first file is loaded</summary>
</key> </key>
<key name="close-auto" type="b">
<default>false</default>
<summary>Automatically close the app after playback finishes</summary>
</key>
<key name="volume-initial" type="s"> <key name="volume-initial" type="s">
<default>"restore"</default> <default>"restore"</default>
<summary>Mode used for startup volume value</summary> <summary>Mode used for startup volume value</summary>