[gnome-music] some workaround
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] some workaround
- Date: Tue, 30 Apr 2013 10:51:32 +0000 (UTC)
commit 5ae1b95d66a5eebef7427fb8169f087375c168a5
Author: Seif Lotfy <seif lotfy com>
Date: Tue Apr 30 12:51:21 2013 +0200
some workaround
src/player.js | 26 +++++++-------------------
1 files changed, 7 insertions(+), 19 deletions(-)
---
diff --git a/src/player.js b/src/player.js
index 8f5ac8b..c477d08 100644
--- a/src/player.js
+++ b/src/player.js
@@ -95,9 +95,8 @@ const Player = new Lang.Class({
Gst.init(null, 0);
this.player = Gst.ElementFactory.make("playbin", "player");
- this.player.connect("about-to-finish", Lang.bind(this,
+ this.connect("about-to-finish", Lang.bind(this,
function() {
- GLib.idle_add(0, Lang.bind(this, function () {
if (this.timeout) {
GLib.source_remove(this.timeout);
}
@@ -107,8 +106,7 @@ const Player = new Lang.Class({
this.load( this.playlist.get_value( this.currentTrack, this.playlist_field));
this.timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, Lang.bind(this,
this._updatePositionCallback));
}
- return false;}))
- }));
+ return false;}));
this.bus = this.player.get_bus();
this.bus.add_signal_watch()
this.bus.connect("message", Lang.bind(this,
@@ -326,25 +324,15 @@ const Player = new Lang.Class({
this.progress_scale.set_draw_value(false);
this._setDuration(1);
- this.progress_scale.connect("button-press-event", Lang.bind(this,
- function() {
- this.player.set_state(Gst.State.PAUSED);
- this._updatePositionCallback();
- GLib.source_remove(this.timeout);
- return false;
- }));
this.progress_scale.connect("value-changed", Lang.bind(this,
function() {
let seconds = Math.floor(this.progress_scale.get_value() / 60);
this.song_playback_time_lbl.set_label(this.seconds_to_string(seconds));
- return false;
- }));
- this.progress_scale.connect("button-release-event", Lang.bind(this,
- function() {
- this.onProgressScaleChangeValue(this.progress_scale);
- this.player.set_state(Gst.State.PLAYING);
- this._updatePositionCallback();
- this.timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, Lang.bind(this,
this._updatePositionCallback));
+ print (seconds, this.duration)
+ if (this.duration == seconds && this.player.get_state(1)[1] != Gst.State.PAUSED) {
+ this.progress_scale.set_value(0.0)
+ GLib.timeout_add (500, null, Lang.bind(this, function () {this.emit("about-to-finish")}))
+ }
return false;
}));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]