banshee r3490 - in trunk/banshee: . src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3490 - in trunk/banshee: . src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks
- Date: Thu, 20 Mar 2008 05:51:58 +0000 (GMT)
Author: gburt
Date: Thu Mar 20 05:51:57 2008
New Revision: 3490
URL: http://svn.gnome.org/viewvc/banshee?rev=3490&view=rev
Log:
2008-03-20 Gabriel Burt <gabriel burt gmail com>
* src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs:
Work around issue with CanSeek being equal to false for a bit after the
engine loads the song we want to jump within.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs
Modified: trunk/banshee/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs Thu Mar 20 05:51:57 2008
@@ -9,6 +9,7 @@
using Banshee.Base;
using Banshee.Collection;
using Banshee.Collection.Database;
+using Banshee.MediaEngine;
using Banshee.Gui;
using Banshee.ServiceStack;
using Hyena;
@@ -254,18 +255,38 @@
DatabaseTrackInfo current_track = ServiceManager.PlayerEngine.CurrentTrack as DatabaseTrackInfo;
if (track != null) {
if (current_track == null || current_track.TrackId != track.TrackId) {
- ServiceManager.PlayerEngine.Open (track);
+ ServiceManager.PlayerEngine.StateChanged += HandleStateChanged;
+ ServiceManager.PlayerEngine.OpenPlay (track);
+ } else {
+ if (ServiceManager.PlayerEngine.CanSeek) {
+ ServiceManager.PlayerEngine.Position = position;
+ } else {
+ ServiceManager.PlayerEngine.StateChanged += HandleStateChanged;
+ ServiceManager.PlayerEngine.Play ();
+ }
}
-
- if (ServiceManager.PlayerEngine.CanSeek) {
- ServiceManager.PlayerEngine.Position = position;
+ } else {
+ Remove();
+ }
+ }
+
+ private void HandleStateChanged (object sender, PlayerEngineStateArgs args)
+ {
+ if (args.State == PlayerEngineState.Playing) {
+ ServiceManager.PlayerEngine.StateChanged -= HandleStateChanged;
+
+ if (!ServiceManager.PlayerEngine.CurrentTrack.IsLive) {
+ // Sleep in 5ms increments for at most 250ms waiting for CanSeek to be true
+ int count = 0;
+ while (count < 50 && !ServiceManager.PlayerEngine.CanSeek) {
+ System.Threading.Thread.Sleep (5);
+ count++;
+ }
}
- if (ServiceManager.PlayerEngine.CurrentState != Banshee.MediaEngine.PlayerEngineState.Playing) {
- ServiceManager.PlayerEngine.Play ();
+ if (ServiceManager.PlayerEngine.CanSeek) {
+ ServiceManager.PlayerEngine.Position = position;
}
- } else {
- Remove();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]