diff --git a/Sources/Linaris/FooterPage.xaml b/Sources/Linaris/FooterPage.xaml index c71d0b8..f1ad801 100644 --- a/Sources/Linaris/FooterPage.xaml +++ b/Sources/Linaris/FooterPage.xaml @@ -18,11 +18,11 @@ - + - + diff --git a/Sources/Linaris/FooterPage.xaml.cs b/Sources/Linaris/FooterPage.xaml.cs index 97ebfa0..1bd4920 100644 --- a/Sources/Linaris/FooterPage.xaml.cs +++ b/Sources/Linaris/FooterPage.xaml.cs @@ -1,4 +1,5 @@ using NAudio.Wave; +using Plugin.Maui.Audio; namespace Linaris; @@ -24,11 +25,23 @@ public partial class FooterPage : ContentView outputDevice.Init(audioFile);*/ } + public void PlayAudio(string path) + { + using (var stream = File.OpenRead(path)) + { + var audioPlayer = AudioManager.Current.CreatePlayer(stream); + audioPlayer.Volume = 100.0f; + audioPlayer.Play(); + } + } + public void PlayButton_Clicked(object sender, EventArgs e) { - Play(); - /*string url = ((FileImageSource)Play.Source).File; - if (url == "play.png") + string CurrentPath = (Application.Current as App).Manager.CurrentPlaying.Path; + if (CurrentPath == null) return; + PlayAudio(CurrentPath); + /*string url = ((FileImageSource)Play.Source).File;*/ + /*if (url == "play.png") { outputDevice?.Play(); Play.Source = "pause.png"; @@ -44,11 +57,6 @@ public partial class FooterPage : ContentView }*/ } - public void Play() - { - if ((Application.Current as App).Manager.CurrentPlaying == null) return; - } - public void RewindButton_Clicked(Object sender, EventArgs e) { /*audioFile.Position = 0; diff --git a/Sources/Linaris/MainPage.xaml b/Sources/Linaris/MainPage.xaml index 76cae65..9837833 100644 --- a/Sources/Linaris/MainPage.xaml +++ b/Sources/Linaris/MainPage.xaml @@ -14,7 +14,9 @@ - + +