Remote playback almost working
This commit is contained in:
@ -24,7 +24,9 @@
|
||||
<Label
|
||||
Text="Queue"/>
|
||||
<qu:Queue
|
||||
ItemsSource="{Binding Queue}"/>
|
||||
ItemsSource="{Binding Queue}"
|
||||
SelectedItem="{Binding SelectedSong}"
|
||||
ItemDoubleClicked="{Binding PlayCommand}"/>
|
||||
</StackLayout>
|
||||
<hs:HostSelector
|
||||
Grid.Row="0"
|
||||
|
@ -8,6 +8,7 @@ using Aurora.Proto.General;
|
||||
using Aurora.Proto.Party;
|
||||
using Aurora.Proto.Events;
|
||||
using Aurora.Services.ClientService;
|
||||
using Aurora.Services.PlayerService;
|
||||
using Aurora.Models.Media;
|
||||
|
||||
namespace Aurora.Design.Views.Party
|
||||
@ -24,8 +25,8 @@ namespace Aurora.Design.Views.Party
|
||||
private PartyState _state;
|
||||
private string _hostname;
|
||||
private ObservableCollection<PartyMember> _members;
|
||||
|
||||
private ObservableCollection<RemoteMediaData> _queue;
|
||||
private ObservableCollection<BaseMedia> _queue;
|
||||
private BaseMedia _selectedSong;
|
||||
|
||||
public PartyViewModel()
|
||||
{
|
||||
@ -33,10 +34,12 @@ namespace Aurora.Design.Views.Party
|
||||
this.HostCommand = new Command(OnHostExecute, CanHostExecute);
|
||||
|
||||
_members = new ObservableCollection<PartyMember>();
|
||||
_queue = new ObservableCollection<RemoteMediaData>();
|
||||
_queue = new ObservableCollection<BaseMedia>();
|
||||
|
||||
SetState(PartyState.SelectingHost);
|
||||
|
||||
PlayCommand = new Command(PlayExecute);
|
||||
|
||||
//Hook up event handler
|
||||
ClientService.Instance.EventReceived += this.OnEventReceived;
|
||||
}
|
||||
@ -70,7 +73,7 @@ namespace Aurora.Design.Views.Party
|
||||
get { return _state != PartyState.SelectingHost; }
|
||||
}
|
||||
|
||||
public ObservableCollection<RemoteMediaData> Queue
|
||||
public ObservableCollection<BaseMedia> Queue
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -94,6 +97,14 @@ namespace Aurora.Design.Views.Party
|
||||
set { SetProperty(ref _hostname, value); }
|
||||
}
|
||||
|
||||
public BaseMedia SelectedSong
|
||||
{
|
||||
get { return _selectedSong; }
|
||||
set { SetProperty(ref _selectedSong, value); }
|
||||
}
|
||||
|
||||
public Command PlayCommand { get; private set; }
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Events
|
||||
@ -209,9 +220,21 @@ namespace Aurora.Design.Views.Party
|
||||
QueueResponse queueResponse = ClientService.Instance.RemotePartyClient.GetQueue(new Empty());
|
||||
|
||||
Queue.Clear();
|
||||
//Convert received data to remote audio models
|
||||
foreach (RemoteMediaData data in queueResponse.MediaList)
|
||||
{
|
||||
Queue.Add(data);
|
||||
//Assign received metadata (since this can't be aquired from a file)
|
||||
AudioMetadata meta = new AudioMetadata();
|
||||
meta.Title = data.Title;
|
||||
meta.Album = data.Album;
|
||||
meta.Artist = data.Artist;
|
||||
meta.Duration = data.Duration;
|
||||
|
||||
RemoteAudio remote = new RemoteAudio(data.Id,
|
||||
meta,
|
||||
ClientService.Instance.RemotePartyClient);
|
||||
|
||||
Queue.Add(remote);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -245,6 +268,11 @@ namespace Aurora.Design.Views.Party
|
||||
Members.Add(member);
|
||||
}
|
||||
|
||||
public void PlayExecute()
|
||||
{
|
||||
PlayerService.Instance.LoadMedia(_selectedSong);
|
||||
PlayerService.Instance.Play();
|
||||
}
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user