From c4d02be9c0be659457dd93ee7bd7c3c4a0f3d7b8 Mon Sep 17 00:00:00 2001 From: Corentin LEMAIRE Date: Sat, 27 May 2023 13:10:18 +0200 Subject: [PATCH] Fix building and tests issues --- Sources/Linaris/FooterPage.xaml | 4 +- Sources/Linaris/FooterPage.xaml.cs | 24 ++++++++---- Sources/Linaris/MainPage.xaml | 4 +- Sources/Linaris/MainPage.xaml.cs | 37 ++++++++++++++++++- Sources/Linaris/PlaylistPage.xaml.cs | 11 +----- Sources/Model/Manager.cs | 6 +++ Sources/Model/Model.csproj | 2 +- .../Serialization/LINQ_XML_Serialization.cs | 1 - Sources/TestUnitaires/TU_Manager.cs | 3 +- 9 files changed, 66 insertions(+), 26 deletions(-) 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 @@ - + +