Playing works when ran with mono debug
This commit is contained in:
@ -15,7 +15,8 @@
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.0.1" />
|
||||
<PackageReference Include="Xamarin.Forms.DataGrid" Version="3.1.0" />
|
||||
<PackageReference Include="taglib-sharp-netstandard2.0" Version="2.1.0" />
|
||||
<PackageReference Include="NAudio" Version="1.9.0" />
|
||||
<PackageReference Include="LibVLCSharp.Forms" Version="3.0.0" />
|
||||
<PackageReference Include="VideoLAN.LibVLC.Mac" Version="3.1.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Frontend\" />
|
||||
@ -33,7 +34,6 @@
|
||||
<Folder Include="Backend\Utils\" />
|
||||
<Folder Include="Backend\Models\" />
|
||||
<Folder Include="Backend\Services\" />
|
||||
<Folder Include="Backend\Services\PlayerService\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Frontend\Components\MusicPlayer\Player.xaml.cs">
|
||||
|
@ -4,7 +4,6 @@ using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using Aurora.Backend.Models;
|
||||
using Aurora.Backend.Utils;
|
||||
using NAudio.Wave;
|
||||
|
||||
namespace Aurora.Backend.Services
|
||||
{
|
||||
|
34
Aurora/Backend/Services/PlayerService.cs
Normal file
34
Aurora/Backend/Services/PlayerService.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using Aurora.Backend.Models;
|
||||
using LibVLCSharp.Shared;
|
||||
|
||||
namespace Aurora.Backend.Services
|
||||
{
|
||||
public class PlayerService : BaseService<PlayerService>
|
||||
{
|
||||
public PlayerService()
|
||||
{
|
||||
}
|
||||
|
||||
public void Play(BaseSong song)
|
||||
{
|
||||
Core.Initialize();
|
||||
using (var libVLC = new LibVLC())
|
||||
{
|
||||
song.Load();
|
||||
var media = new Media(libVLC, song.DataStream);
|
||||
using (var mp = new MediaPlayer(media))
|
||||
{
|
||||
media.Dispose();
|
||||
mp.Play();
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
song.Unload();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Aurora.Backend.Models;
|
||||
using Aurora.Backend.Services;
|
||||
using Aurora.Backend.Services.PlayerService;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Frontend.Views.Songs
|
||||
@ -48,6 +47,11 @@ namespace Aurora.Frontend.Views.Songs
|
||||
SongsList = LibraryService.Instance.GetLibrary();
|
||||
}
|
||||
|
||||
public void PlayExecute()
|
||||
{
|
||||
PlayerService.Instance.Play(_selectedSong);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user