|
|
|
@ -6,8 +6,6 @@ namespace Linaris;
|
|
|
|
|
|
|
|
|
|
public partial class MainPage : ContentPage
|
|
|
|
|
{
|
|
|
|
|
private readonly IAudioManager audioManager;
|
|
|
|
|
|
|
|
|
|
private readonly ObservableCollection<Album> albums = (Application.Current as App).Manager.GetAlbums();
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<Album> Albums
|
|
|
|
@ -15,11 +13,10 @@ public partial class MainPage : ContentPage
|
|
|
|
|
get => albums;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MainPage(IAudioManager audioManager)
|
|
|
|
|
public MainPage()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
BindingContext = this;
|
|
|
|
|
this.audioManager = audioManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async void GoToAlbum(object sender, EventArgs e)
|
|
|
|
@ -34,21 +31,22 @@ public partial class MainPage : ContentPage
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayAudio(string path)
|
|
|
|
|
public async void PlayAudio(string path)
|
|
|
|
|
{
|
|
|
|
|
using (var stream = File.OpenRead(path))
|
|
|
|
|
var audioPlayer = AudioManager.Current.CreatePlayer(await FileSystem.OpenAppPackageFileAsync("peaches.mp3"));
|
|
|
|
|
audioPlayer.Play();
|
|
|
|
|
/*using (var stream = File.OpenRead(path))
|
|
|
|
|
{
|
|
|
|
|
var audioPlayer = audioManager.CreatePlayer(stream);
|
|
|
|
|
audioPlayer.Volume = 1.0f;
|
|
|
|
|
audioPlayer = audioManager.CreatePlayer(stream);
|
|
|
|
|
audioPlayer.Play();
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void play(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string CurrentPath = (Application.Current as App).Manager.CurrentPlaying.Path;
|
|
|
|
|
if (CurrentPath == null) return;
|
|
|
|
|
PlayAudio(CurrentPath);
|
|
|
|
|
/*string CurrentPath = (Application.Current as App).Manager.CurrentPlaying.Path;
|
|
|
|
|
if (CurrentPath == null) return;*/
|
|
|
|
|
PlayAudio("");
|
|
|
|
|
/*string url = ((FileImageSource)Play.Source).File;*/
|
|
|
|
|
/*if (url == "play.png")
|
|
|
|
|
{
|
|
|
|
|