mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Add player seek_done property
This commit is contained in:
@@ -345,7 +345,7 @@ class ClapperInterface extends Gtk.Grid
|
||||
{
|
||||
switch(state) {
|
||||
case GstPlayer.PlayerState.BUFFERING:
|
||||
if(!this._player.isLocalFile)
|
||||
if(!this._player.is_local_file)
|
||||
this.needsTracksUpdate = true;
|
||||
break;
|
||||
case GstPlayer.PlayerState.STOPPED:
|
||||
@@ -395,6 +395,7 @@ class ClapperInterface extends Gtk.Grid
|
||||
{
|
||||
if(
|
||||
!this.isSeekable
|
||||
|| !this._player.seek_done
|
||||
|| this.controls.isPositionSeeking
|
||||
|| this._player.state === GstPlayer.PlayerState.BUFFERING
|
||||
)
|
||||
|
@@ -51,7 +51,8 @@ class ClapperPlayer extends GstPlayer.Player
|
||||
this.renderer = renderer;
|
||||
|
||||
this.gstRegistry = Gst.Registry.get();
|
||||
this.isLocalFile = false;
|
||||
this.is_local_file = false;
|
||||
this.seek_done = true;
|
||||
|
||||
this._playerSignals = [];
|
||||
this._widgetSignals = [];
|
||||
@@ -100,6 +101,7 @@ class ClapperPlayer extends GstPlayer.Player
|
||||
|
||||
this.connect('state-changed', this._onStateChanged.bind(this));
|
||||
this.connect('uri-loaded', this._onUriLoaded.bind(this));
|
||||
this.connect('seek-done', this._onSeekDone.bind(this));
|
||||
this.connect('end-of-stream', this._onStreamEnded.bind(this));
|
||||
this.connect('warning', this._onPlayerWarning.bind(this));
|
||||
this.connect('error', this._onPlayerError.bind(this));
|
||||
@@ -117,7 +119,7 @@ class ClapperPlayer extends GstPlayer.Player
|
||||
debug(`parsed source to URI: ${source}`);
|
||||
|
||||
if(Gst.Uri.get_protocol(source) !== 'file') {
|
||||
this.isLocalFile = false;
|
||||
this.is_local_file = false;
|
||||
return this.set_uri(source);
|
||||
}
|
||||
|
||||
@@ -136,7 +138,7 @@ class ClapperPlayer extends GstPlayer.Player
|
||||
if(file.get_path().endsWith(`.${this.playlist_ext}`))
|
||||
return this.load_playlist_file(file);
|
||||
|
||||
this.isLocalFile = true;
|
||||
this.is_local_file = true;
|
||||
this.set_uri(source);
|
||||
}
|
||||
|
||||
@@ -198,6 +200,13 @@ class ClapperPlayer extends GstPlayer.Player
|
||||
return this.visualization_enabled;
|
||||
}
|
||||
|
||||
seek(position)
|
||||
{
|
||||
this.seek_done = false;
|
||||
|
||||
super.seek(position);
|
||||
}
|
||||
|
||||
seek_seconds(position)
|
||||
{
|
||||
this.seek(position * 1000000000);
|
||||
@@ -252,12 +261,19 @@ class ClapperPlayer extends GstPlayer.Player
|
||||
{
|
||||
this.state = state;
|
||||
|
||||
if(
|
||||
this.run_loop
|
||||
&& this.state === GstPlayer.PlayerState.STOPPED
|
||||
&& this.loop.is_running()
|
||||
)
|
||||
this.loop.quit();
|
||||
if(this.state === GstPlayer.PlayerState.STOPPED) {
|
||||
this.seek_done = true;
|
||||
if(
|
||||
this.run_loop
|
||||
&& this.loop.is_running()
|
||||
)
|
||||
this.loop.quit();
|
||||
}
|
||||
}
|
||||
|
||||
_onSeekDone()
|
||||
{
|
||||
this.seek_done = true;
|
||||
}
|
||||
|
||||
_onStreamEnded(player)
|
||||
|
Reference in New Issue
Block a user