GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit 446824e9 authored by Axelander's avatar Axelander
Browse files

Issue 41 playlist crash

parent ba2fb841
This diff is collapsed.
......@@ -17,4 +17,12 @@ C# library which implements the MusicBrainz API.
- Author: [avatar29A](https://github.com/avatar29A)
- Source: [GitHub](https://github.com/avatar29A)
- License: [The MIT License (MIT)](https://github.com/avatar29A/MusicBrainz/blob/master/LICENSE.txt)
\ No newline at end of file
- License: [The MIT License (MIT)](https://github.com/avatar29A/MusicBrainz/blob/master/LICENSE.txt)
### Json.NET Schema
Json.NET Schema is a powerful, complete and easy to use JSON Schema framework for .NET
- Author: [Newtonsoft](http://www.newtonsoft.com/)
- Source: [GitHub](https://github.com/JamesNK/Newtonsoft.Json.Schema)
- License: [GNU Affero General Public License Version 3](http://www.gnu.org/licenses/agpl-3.0.html)
\ No newline at end of file
......@@ -28,14 +28,14 @@ namespace SonicStreamer.Test.Common
public async Task AddToPlaybackTestAsync()
{
var tracks = await GetSampleTracks();
await PlaybackService.Current.AddToPlaybackAsync(tracks);
PlaybackService.Current.AddToPlaybackAsync(tracks);
Assert.AreEqual(tracks.Count, PlaybackService.Current.Playback.Items.Count);
// Duplicate Check
await PlaybackService.Current.AddToPlaybackAsync(tracks, false);
PlaybackService.Current.AddToPlaybackAsync(tracks, false);
Assert.AreEqual(tracks.Count, PlaybackService.Current.Playback.Items.Count);
// Replace Playback
tracks.RemoveAt(0);
await PlaybackService.Current.AddToPlaybackAsync(tracks);
PlaybackService.Current.AddToPlaybackAsync(tracks);
Assert.AreEqual(tracks.Count, PlaybackService.Current.Playback.Items.Count);
PlaybackService.Current.ResetPlayabck();
}
......@@ -56,7 +56,7 @@ namespace SonicStreamer.Test.Common
{
var tracks = await GetSampleTracks();
PlaybackService.Current.SetShuffleMode(false);
await PlaybackService.Current.AddToPlaybackAsync(tracks);
PlaybackService.Current.AddToPlaybackAsync(tracks);
var playbackItem = PlaybackService.Current.Playback.Items.First();
var displayProperties = playbackItem.GetDisplayProperties();
Assert.AreEqual(tracks.First().Id,
......@@ -86,7 +86,7 @@ namespace SonicStreamer.Test.Common
var newOrder = GetTrackIdOrder();
Assert.AreNotEqual(oldOrder, newOrder);
await PlaybackService.Current.AddToPlaybackAsync(tracks);
PlaybackService.Current.AddToPlaybackAsync(tracks);
Assert.AreNotEqual(newOrder, GetTrackIdOrder());
PlaybackService.Current.ResetPlayabck();
}
......@@ -97,7 +97,7 @@ namespace SonicStreamer.Test.Common
var tracks = await GetSampleTracks();
// Add only one track to trigger Play mode
await PlaybackService.Current.AddToPlaybackAsync(tracks.First());
PlaybackService.Current.AddToPlaybackAsync(tracks.First());
await Task.Delay(2000);
Assert.AreEqual(MediaPlaybackState.Playing, PlaybackService.Current.Player.PlaybackSession.PlaybackState);
......@@ -107,7 +107,7 @@ namespace SonicStreamer.Test.Common
Assert.AreEqual(MediaPlaybackState.Paused, PlaybackService.Current.Player.PlaybackSession.PlaybackState);
// Add now all tracks to test correct Play/Pause behaviour
await PlaybackService.Current.AddToPlaybackAsync(tracks, false);
PlaybackService.Current.AddToPlaybackAsync(tracks, false);
await Task.Delay(2000);
Assert.AreEqual(MediaPlaybackState.Paused, PlaybackService.Current.Player.PlaybackSession.PlaybackState);
......@@ -122,7 +122,7 @@ namespace SonicStreamer.Test.Common
Assert.AreNotEqual(MediaPlaybackState.Playing, PlaybackService.Current.Player.PlaybackSession.PlaybackState);
// Test Auto Play for empty playback
await PlaybackService.Current.AddToPlaybackAsync(tracks, false);
PlaybackService.Current.AddToPlaybackAsync(tracks, false);
await Task.Delay(2000);
Assert.AreEqual(MediaPlaybackState.Playing, PlaybackService.Current.Player.PlaybackSession.PlaybackState);
PlaybackService.Current.ResetPlayabck();
......@@ -133,7 +133,7 @@ namespace SonicStreamer.Test.Common
{
var tracks = await GetSampleTracks();
PlaybackService.Current.SetShuffleMode(false);
await PlaybackService.Current.AddToPlaybackAsync(tracks);
PlaybackService.Current.AddToPlaybackAsync(tracks);
await Task.Delay(2000);
// Test PlayNext
......@@ -163,13 +163,15 @@ namespace SonicStreamer.Test.Common
}
[TestMethod]
[Ignore]
public async Task JumpTestAsync()
{
// TODO Create new Sample Data
var tracks = await GetSampleTracks();
await PlaybackService.Current.AddToPlaybackAsync(tracks);
PlaybackService.Current.AddToPlaybackAsync(tracks);
var rnd = new Random();
var rndTrack = tracks.ElementAt(rnd.Next(tracks.Count - 1));
PlaybackService.Current.Jump(rndTrack);
//PlaybackService.Current.Jump(rndTrack);
// delay required to wait for updated CurrentItem
await Task.Delay(2000);
......
......@@ -40,7 +40,7 @@ namespace SonicStreamer.Test.ViewModels
var playbackVm = new PlaybackViewModel();
ResourceLoader.Current.SetNewTempResource(playbackVm, Constants.ViewModelPlayback);
tracks = await GetSampleTracks();
await PlaybackService.Current.AddToPlaybackAsync(tracks);
PlaybackService.Current.AddToPlaybackAsync(tracks);
await Task.Delay(2000);
return playbackVm;
}
......@@ -53,23 +53,22 @@ namespace SonicStreamer.Test.ViewModels
{
Assert.AreEqual(
PlaybackService.Current.Playback.CurrentItem.Source.CustomProperties[Constants.PlaybackTrackId].ToString
(), playbackVm.CurrentTrack.Id);
(), playbackVm.PlaybackCurrentTrack.Source.CustomProperties[Constants.PlaybackTrackId]);
Assert.AreEqual(
PlaybackService.Current.Playback.CurrentItem.Source.CustomProperties[Constants.PlaybackArtistId]
.ToString(), playbackVm.CurrentTrack.ArtistId);
.ToString(), playbackVm.PlaybackCurrentTrack.Source.CustomProperties[Constants.PlaybackArtistId]);
Assert.AreEqual(
((CoverArt)
PlaybackService.Current.Playback.CurrentItem.Source.CustomProperties[Constants.PlaybackCover]).Id,
playbackVm.CurrentTrack.Cover.Id);
PlaybackService.Current.Playback.CurrentItem.Source.CustomProperties[Constants.PlaybackCover],
playbackVm.PlaybackCurrentTrack.Source.CustomProperties[Constants.PlaybackCover]);
Assert.AreEqual(
PlaybackService.Current.Playback.CurrentItem.Source.CustomProperties[Constants.PlaybackDuration]
.ToString(), playbackVm.CurrentTrack.Duration);
.ToString(), playbackVm.PlaybackCurrentTrack.Source.CustomProperties[Constants.PlaybackDuration]);
var displayProperties = PlaybackService.Current.Playback.CurrentItem.GetDisplayProperties();
Assert.AreEqual(displayProperties.MusicProperties.Title, playbackVm.CurrentTrack.Name);
Assert.AreEqual(displayProperties.MusicProperties.Artist, playbackVm.CurrentTrack.Artist);
Assert.AreEqual(displayProperties.MusicProperties.AlbumTitle, playbackVm.CurrentTrack.Album);
Assert.AreEqual(PlaybackService.Current.Playback.Items.Count, playbackVm.Tracks.Count);
Assert.AreEqual(displayProperties.MusicProperties.Title, playbackVm.PlaybackCurrentTrack.Source.CustomProperties[Constants.PlaybackName]);
Assert.AreEqual(displayProperties.MusicProperties.Artist, playbackVm.PlaybackCurrentTrack.Source.CustomProperties[Constants.PlaybackArtist]);
Assert.AreEqual(displayProperties.MusicProperties.AlbumTitle, playbackVm.PlaybackCurrentTrack.Source.CustomProperties[Constants.PlaybackAlbum]);
Assert.AreEqual(PlaybackService.Current.Playback.Items.Count, playbackVm.PlaybackTracks.Count);
}
[TestMethod]
......@@ -78,10 +77,10 @@ namespace SonicStreamer.Test.ViewModels
using (var playbackVm = new PlaybackViewModel())
{
await playbackVm.LoadDataAsync();
Assert.AreEqual(0, playbackVm.Tracks.Count);
Assert.AreEqual(0, playbackVm.PlaybackTracks.Count);
Assert.AreEqual(Symbol.Play, playbackVm.PlayButtonIcon);
Assert.AreEqual(PlaybackViewModel.PlaybackPanelStatus.Large, playbackVm.PanelStaus);
Assert.IsNull(playbackVm.CurrentTrack);
Assert.IsNull(playbackVm.PlaybackCurrentTrack);
Assert.IsNull(playbackVm.CurrentArtistInfo);
Assert.IsFalse(playbackVm.IsPlaybackPanelVisible);
PlaybackService.Current.ResetPlayabck();
......@@ -117,8 +116,8 @@ namespace SonicStreamer.Test.ViewModels
AssertCurrentTrack(playbackVm);
// Add test with duplicates
await PlaybackService.Current.AddToPlaybackAsync(tracks, false);
Assert.AreEqual(PlaybackService.Current.Playback.Items.Count, playbackVm.Tracks.Count);
PlaybackService.Current.AddToPlaybackAsync(tracks, false);
Assert.AreEqual(PlaybackService.Current.Playback.Items.Count, playbackVm.PlaybackTracks.Count);
PlaybackService.Current.ResetPlayabck();
}
}
......@@ -145,7 +144,7 @@ namespace SonicStreamer.Test.ViewModels
{
using (var playbackVm = await InitNewPlayback(await GetSampleTracks()))
{
playbackVm.Jump(playbackVm.Tracks.Last());
playbackVm.Jump(playbackVm.PlaybackTracks.Last());
await Task.Delay(2000);
AssertCurrentTrack(playbackVm);
PlaybackService.Current.ResetPlayabck();
......@@ -158,7 +157,7 @@ namespace SonicStreamer.Test.ViewModels
using (var playbackVm = await InitNewPlayback(await GetSampleTracks()))
{
await playbackVm.LoadDataAsync();
Assert.AreEqual(playbackVm.CurrentTrack.Artist, playbackVm.CurrentArtistInfo.Name);
Assert.AreEqual(playbackVm.PlaybackCurrentTrack.Source.CustomProperties[Constants.PlaybackArtist], playbackVm.CurrentArtistInfo.Name);
Assert.AreNotEqual(playbackVm.CurrentArtistInfo.SocialLinks.Count, 0);
PlaybackService.Current.ResetPlayabck();
}
......
......@@ -132,6 +132,7 @@ namespace SonicStreamer
{
var deferral = e.SuspendingOperation.GetDeferral();
var saveTasks = new List<Task>();
var cacheTask = PlaybackService.Current.SaveCachedObjectsAsync();
foreach (var ressource in Current.Resources)
{
var viewModel = ressource.Value as IViewModelSerializable;
......@@ -141,6 +142,7 @@ namespace SonicStreamer
}
}
await Task.WhenAll(saveTasks);
await cacheTask;
deferral.Complete();
}
......
......@@ -20,6 +20,10 @@
public const string ContainerLogin = "LoginSettings";
public const string SettingServerType = "ServerType";
// LocalSettings
public const string CacheFileName = "cache.json";
public const string TrackCacheFolder = "tracks";
// MusicBrainz
public const string MusicBrainzArtistQueryParams =
......@@ -48,5 +52,6 @@
public const string PlaybackAlbumId = "albumId";
public const string PlaybackCover = "cover";
public const string PlaybackDuration = "duration";
public const string PlaybackDurationOutput = "durationOutput";
}
}
\ No newline at end of file
......@@ -6,8 +6,10 @@ using System.Linq;
using System.Threading.Tasks;
using Windows.Media;
using Windows.Media.Playback;
using Windows.Networking.BackgroundTransfer;
using Windows.Storage;
using Windows.Storage.Streams;
using Newtonsoft.Json;
namespace SonicStreamer.Common.System
{
......@@ -17,9 +19,12 @@ namespace SonicStreamer.Common.System
public MediaPlaybackList Playback { get; }
private static PlaybackService _current;
public static PlaybackService Current => _current ?? (_current = new PlaybackService());
public Dictionary<string, string> CachedPlayableObjects { get; private set; }
protected PlaybackService()
{
Player = new MediaPlayer
......@@ -32,20 +37,62 @@ namespace SonicStreamer.Common.System
AutoRepeatEnabled = true,
ShuffleEnabled = Convert.ToBoolean(ApplicationData.Current.RoamingSettings.Values["IsShuffling"])
};
CachedPlayableObjects = new Dictionary<string, string>();
}
/// <summary>
/// Restores Cached Ids from a JSON file in the LocalFolder
/// </summary>
public async Task RestoreCachedObjectsAsync()
{
try
{
var file = await ApplicationData.Current.LocalFolder.GetFileAsync(Constants.CacheFileName);
CachedPlayableObjects = JsonConvert.DeserializeObject<Dictionary<string, string>>(await FileIO.ReadTextAsync(file));
}
catch
{
CachedPlayableObjects = new Dictionary<string, string>();
}
// TODO check if local files really exists in background
}
/// <summary>
/// Saves all Cached Ids in a JSON file in the LocalFolder
/// </summary>
/// <returns></returns>
public async Task SaveCachedObjectsAsync()
{
try
{
if (CachedPlayableObjects.Count == 0) return;
var json = JsonConvert.SerializeObject(CachedPlayableObjects);
var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("cache.json", CreationCollisionOption.ReplaceExisting);
await FileIO.WriteTextAsync(file, json);
}
catch
{
// ignore
}
}
#region Playback Manipulation
/// <summary>
/// Konvertiert ein <see cref="Track"/> in ein <see cref="MediaPlaybackItem"/>
/// Converts a <see cref="Track"/> into a <see cref="MediaPlaybackItem"/>
/// </summary>
private async Task<MediaPlaybackItem> CreatePlaybackItemAsync(SubsonicPlayableObject playableObject)
private MediaPlaybackItem CreatePlaybackItemAsync(SubsonicPlayableObject playableObject)
{
var source = Windows.Media.Core.MediaSource.CreateFromUri(await playableObject.GetSource());
var source = Windows.Media.Core.MediaSource.CreateFromUri(playableObject.GetSource());
source.CustomProperties[Constants.PlaybackTrackId] = playableObject.Id;
source.CustomProperties[Constants.PlaybackName] = playableObject.Name;
source.CustomProperties[Constants.PlaybackArtistId] = playableObject.ArtistId;
source.CustomProperties[Constants.PlaybackCover] = playableObject.Cover;
source.CustomProperties[Constants.PlaybackArtist] = playableObject.Artist;
source.CustomProperties[Constants.PlaybackAlbumId] = playableObject.AlbumId;
source.CustomProperties[Constants.PlaybackAlbum] = playableObject.Album;
source.CustomProperties[Constants.PlaybackCover] = playableObject.Cover.Uri;
source.CustomProperties[Constants.PlaybackDuration] = playableObject.Duration;
source.CustomProperties[Constants.PlaybackDurationOutput] = playableObject.DurationOutput;
var result = new MediaPlaybackItem(source);
var displayProperties = result.GetDisplayProperties();
displayProperties.Type = MediaPlaybackType.Music;
......@@ -67,7 +114,7 @@ namespace SonicStreamer.Common.System
}
/// <summary>
/// Prüft ob der übergebene Track bereits in der Wiedergabeliste vorhanden ist
/// Checks if the passed <see cref="SubsonicPlayableObject"/> is already available in the playback
/// </summary>
private bool DuplicateCheck(SubsonicPlayableObject playbackObject)
{
......@@ -78,11 +125,11 @@ namespace SonicStreamer.Common.System
}
/// <summary>
/// Fügt die Tracks zur Wiedergabeliste hinzu.
/// Adds a set of <see cref="SubsonicPlayableObject"/> to the playback
/// </summary>
/// <param name="playableObjects">Hinzuzufügende Tracks</param>
/// <param name="newPlayback">True - erstellt ein neues Playback und ersetzt das alte</param>
public async Task AddToPlaybackAsync(IEnumerable<SubsonicPlayableObject> playableObjects, bool newPlayback = true)
/// <param name="playableObjects">Objects to be added</param>
/// <param name="newPlayback">True - creates a new Playback replaces all available objects</param>
public void AddToPlaybackAsync(IEnumerable<SubsonicPlayableObject> playableObjects, bool newPlayback = true)
{
if (newPlayback)
{
......@@ -91,49 +138,49 @@ namespace SonicStreamer.Common.System
playbackVm.Clear();
ResetPlayabck();
}
var wasPlaybackEmpty = Playback.Items.Count == 0;
var addedObjects = new List<SubsonicPlayableObject>();
foreach (var item in playableObjects)
var cleanedList = playableObjects.Where(item => !DuplicateCheck(item)).ToList();
foreach (var item in cleanedList)
{
if (DuplicateCheck(item)) continue;
Playback.Items.Add(await CreatePlaybackItemAsync(item));
addedObjects.Add(item);
Playback.Items.Add(CreatePlaybackItemAsync(item));
}
if (wasPlaybackEmpty && Playback.Items.Count > 0)
{
Player.Source = Playback;
Player.Play();
}
UpdatePlaybackViewModelTracks();
UpdatePlaybackViewModel();
}
/// <summary>
/// Fügt den Track zur Wiedergabeliste hinzu.
/// Adds a <see cref="SubsonicPlayableObject"/> to the playback
/// </summary>
/// <param name="playableObject">Hinzuzufügender Track</param>
/// <param name="newPlayback">True - erstellt ein neues Playback und ersetzt das alte</param>
public async Task AddToPlaybackAsync(SubsonicPlayableObject playableObject, bool newPlayback = true)
/// <param name="playableObject">Object to be added</param>
/// <param name="newPlayback">True - creates a new Playback replaces all available objects</param>
public void AddToPlaybackAsync(SubsonicPlayableObject playableObject, bool newPlayback = true)
{
await AddToPlaybackAsync(new List<SubsonicPlayableObject> {playableObject}, newPlayback);
AddToPlaybackAsync(new List<SubsonicPlayableObject> {playableObject}, newPlayback);
}
/// <summary>
/// Fügt alle Tracks eines Albums zur Wiedergabeliste hinzu.
/// Adds all Tracks of an Album to the playback
/// </summary>
/// <param name="album">Hinzuzufügendes Album</param>
/// <param name="newPlayback">True - erstellt ein neues Playback und ersetzt das alte</param>
public async Task AddToPlaybackAsync(Album album, bool newPlayback = true)
/// <param name="album">Album to be added</param>
/// <param name="newPlayback">True - creates a new Playback replaces all available objects</param>
public void AddToPlaybackAsync(Album album, bool newPlayback = true)
{
await AddToPlaybackAsync(album.Tracks, newPlayback);
AddToPlaybackAsync(album.Tracks, newPlayback);
}
/// <summary>
/// Fügt alle Tracks eines Interpreten zur Wiedergabeliste hinzu.
/// Adds all Tracks of an Artist to the playback
/// </summary>
/// <param name="artist">Hinzuzufügender Interpret</param>
/// <param name="newPlayback">True - erstellt ein neues Playback und ersetzt das alte</param>
public async Task AddToPlaybackAsync(Artist artist, bool newPlayback = true)
/// <param name="artist">Artist to be added</param>
/// <param name="newPlayback">True - creates a new Playback replaces all available objects</param>
public void AddToPlaybackAsync(Artist artist, bool newPlayback = true)
{
var tracks = new List<Track>();
......@@ -141,11 +188,11 @@ namespace SonicStreamer.Common.System
{
tracks.AddRange(album.Tracks);
}
await AddToPlaybackAsync(tracks, newPlayback);
AddToPlaybackAsync(tracks, newPlayback);
}
/// <summary>
/// Setzt die komplette Wiedergabeliste zurück
/// Resets the complete playback
/// </summary>
public void ResetPlayabck()
{
......@@ -157,48 +204,41 @@ namespace SonicStreamer.Common.System
}
/// <summary>
/// Aktiviert oder Deaktiviert die Zufallswiedergabe beim Playback und aktualisiert das PlaybackViewModel
/// Activates or Deactivates Shuffle Mode and updates the <see cref="PlaybackViewModel"/>
/// </summary>
public void SetShuffleMode(bool value)
{
Playback.ShuffleEnabled = value;
UpdatePlaybackViewModelTracks();
UpdatePlaybackViewModel();
}
/// <summary>
/// Aktualisiert die Tracks des PlaybackViewModel
/// Updates data of the <see cref="PlaybackViewModel"/> after changing the Shuffle Mode
/// </summary>
private void UpdatePlaybackViewModelTracks()
private void UpdatePlaybackViewModel()
{
var playbackVm = new PlaybackViewModel();
ResourceLoader.Current.GetResource(ref playbackVm, Constants.ViewModelPlayback);
playbackVm.Tracks.Clear();
foreach (var item in GetPlaybackObjects())
var currentItems = Playback.ShuffleEnabled ? Playback.ShuffledItems.ToList() : Playback.Items.ToList();
foreach (var item in currentItems)
{
playbackVm.Tracks.Add(new SubsonicPlayableObject(item));
playbackVm.PlaybackTracks.Add(item);
}
/* Restore CurrentTrack
*
* Playback.CurrentItem könnte noch null sein, wenn zum ersten mal Tracks hinzugefügt werden. Der CurrentTrack wird dann
* über PlaybackService.Current.Playback.CurrentItemChanged im PlaybackViewModel aktualisiert
* It could be possible that Playback.CurrentItem is null after adding Tracks for the first time.
* CurrentTrack will be set via PlaybackService.Current.Playback.CurrentItemChanged in the PlaybackViewModel
*/
if (playbackVm.Tracks.Count > 0 && Playback.CurrentItem != null)
if (playbackVm.PlaybackTracks.Count > 0 && Playback.CurrentItem != null)
{
var currentObject =
playbackVm.Tracks.FirstOrDefault(
item =>
item.Id == Playback.CurrentItem.Source.CustomProperties[Constants.PlaybackTrackId] as string);
if (currentObject != null)
{
playbackVm.CurrentTrack = currentObject;
}
playbackVm.PlaybackCurrentTrack = Playback.CurrentItem;
}
}
/// <summary>
/// Aktiviert oder Deaktiviert die Wiederholung beim Playback
/// Activates or Deactivates Loop Mode
/// </summary>
public void SetRepeatingMode(bool value)
public void SetLoopMode(bool value)
{
Player.IsLoopingEnabled = value;
}
......@@ -208,7 +248,7 @@ namespace SonicStreamer.Common.System
#region Playback Handling
/// <summary>
/// Startet oder Pausiert die Wiedergabe
/// Starts or pauses the playback
/// </summary>
public void PlayPause()
{
......@@ -224,7 +264,7 @@ namespace SonicStreamer.Common.System
}
/// <summary>
/// Spielt das nächste Element im Playback ab
/// Plays next element in the playback
/// </summary>
public void PlayNext()
{
......@@ -232,7 +272,7 @@ namespace SonicStreamer.Common.System
}
/// <summary>
/// Spielt das vorherige Element im Playback ab
/// Plays previous element in the playback
/// </summary>
public void PlayPrevious()
{
......@@ -240,13 +280,16 @@ namespace SonicStreamer.Common.System
}
/// <summary>
/// Springt im Playback zum übergebenen Wiedergabeobject
/// Jumps to the passed <see cref="MediaPlaybackItem"/>
/// </summary>
public void Jump(SubsonicPlayableObject playbackItem)
public void Jump(MediaPlaybackItem playbackItem)
{
var index =
Playback.Items.ToList()
.FindIndex(i => (string) i.Source.CustomProperties[Constants.PlaybackTrackId] == playbackItem.Id);
.FindIndex(
i =>
i.Source.CustomProperties[Constants.PlaybackTrackId] as string ==
playbackItem.Source.CustomProperties[Constants.PlaybackTrackId] as string);
if (index != -1)
{
Playback.MoveTo((uint) index);
......@@ -260,7 +303,7 @@ namespace SonicStreamer.Common.System
#endregion
/// <summary>
/// Gibt alle Wiedergabeobjekte in Abhängigkeit von der Zufallswiedergabe vom Playback zurück
/// Returns all <see cref="MediaPlaybackItem"/> depending on the current Shuffle Mode
/// </summary>
public IEnumerable<MediaPlaybackItem> GetPlaybackObjects()
{
......
......@@ -32,17 +32,17 @@
</Grid.RowDefinitions>
<Grid Margin="0,0,0,5">
<Image Source="ms-appx:///Assets/cover.png" />
<Image Canvas.ZIndex="1" Source="{Binding CurrentTrack.Cover.Uri}" />
<Image Canvas.ZIndex="1" Source="{Binding PlaybackCurrentTrack.Source.CustomProperties[cover]}" />
</Grid>
<StackPanel Grid.Row="1">
<TextBlock
FontWeight="SemiBold"
Style="{StaticResource OrangeTitleTextBlockStyle}"
Text="{Binding CurrentTrack.Name}"
Text="{Binding PlaybackCurrentTrack.Source.CustomProperties[name]}"
TextAlignment="Center" />
<TextBlock
Style="{StaticResource OrangeSubtitleTextBlockStyle}"
Text="{Binding CurrentTrack.Artist}"
Text="{Binding PlaybackCurrentTrack.Source.CustomProperties[artist]}"
TextAlignment="Center" />
</StackPanel>
</Grid>
......
......@@ -171,11 +171,11 @@
</Grid.ColumnDefinitions>
<Grid Margin="5,0">
<Image Source="ms-appx:///Assets/cover.png" />
<Image Canvas.ZIndex="1" Source="{Binding CurrentTrack.Cover.Uri}" />
<Image Canvas.ZIndex="1" Source="{Binding PlaybackCurrentTrack.Source.CustomProperties[cover]}" />
</Grid>
<StackPanel Grid.Column="1">
<TextBlock Style="{StaticResource OrangeItemTitleTextBlockStyle}" Text="{Binding CurrentTrack.Name}" />
<TextBlock Style="{StaticResource OrangeItemSubtitleTextBlockStyle}" Text="{Binding CurrentTrack.Artist}" />
<TextBlock Style="{StaticResource OrangeItemTitleTextBlockStyle}" Text="{Binding PlaybackCurrentTrack.Source.CustomProperties[name]}" />
<TextBlock Style="{StaticResource OrangeItemSubtitleTextBlockStyle}" Text="{Binding PlaybackCurrentTrack.Source.CustomProperties[artist]}" />
</StackPanel>
</Grid>
<StackPanel Grid.Column="1" Orientation="Horizontal">
......@@ -203,11 +203,11 @@
</Grid.ColumnDefinitions>
<Grid Margin="5,0">