Playing works when ran with mono debug

This commit is contained in:
watsonb8 2019-05-22 18:59:15 -04:00
parent a4276a0d5d
commit 5427d08dd7
11 changed files with 181 additions and 36 deletions

View File

@ -81,15 +81,52 @@
<Reference Include="Xamarin.Forms.DataGrid">
<HintPath>..\packages\Xamarin.Forms.DataGrid.3.1.0\lib\netstandard2.0\Xamarin.Forms.DataGrid.dll</HintPath>
</Reference>
<Reference Include="NAudio">
<HintPath>..\packages\NAudio.1.9.0\lib\net35\NAudio.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.ValueTuple">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="LibVLCSharp">
<HintPath>..\packages\LibVLCSharp.3.0.0\lib\net40\LibVLCSharp.dll</HintPath>
</Reference>
<Reference Include="LibVLCSharp.Forms">
<HintPath>..\packages\LibVLCSharp.Forms.3.0.0\lib\netstandard2.0\LibVLCSharp.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
<Reference Include="LibVLCSharp.GTK">
<HintPath>..\packages\LibVLCSharp.GTK.3.0.0\lib\net47\LibVLCSharp.GTK.dll</HintPath>
</Reference>
<Reference Include="LibVLCSharp.Forms.Platforms.GTK">
<HintPath>..\packages\LibVLCSharp.Forms.GTK.3.0.0\lib\net47\LibVLCSharp.Forms.Platforms.GTK.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="gtk-gui\gui.stetic">
<LogicalName>gui.stetic</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="OpenTK.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="webkit-sharp.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="LibVLCSharp.GTK.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="LibVLCSharp.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="gtk-gui\generated.cs" />
@ -100,8 +137,6 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="webkit-sharp.dll.config" />
<None Include="OpenTK.dll.config" />
<None Include="Themes\apps.rc" />
<None Include="Themes\assets-dark.svg" />
<None Include="Themes\assets.svg" />
@ -424,4 +459,5 @@
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.targets')" />
<Import Project="..\packages\VideoLAN.LibVLC.Mac.3.1.2\build\VideoLAN.LibVLC.Mac.targets" Condition="Exists('..\packages\VideoLAN.LibVLC.Mac.3.1.2\build\VideoLAN.LibVLC.Mac.targets')" />
</Project>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1" />
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1" />
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1" />
<dllmap os="linux" dll="alut.dll" target="libalut.so.0" />
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so" />
<dllmap os="linux" dll="libX11" target="libX11.so.6" />
<dllmap os="linux" dll="libXi" target="libXi.so.6" />
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0" />
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL" />
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL" />
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib" />
<!-- XQuartz compatibility (X11 on Mac) -->
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib" />
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib" />
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib" />
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib" />
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib" />
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib" />
</configuration>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1" />
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1" />
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1" />
<dllmap os="linux" dll="alut.dll" target="libalut.so.0" />
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so" />
<dllmap os="linux" dll="libX11" target="libX11.so.6" />
<dllmap os="linux" dll="libXi" target="libXi.so.6" />
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0" />
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL" />
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL" />
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib" />
<!-- XQuartz compatibility (X11 on Mac) -->
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib" />
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib" />
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib" />
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib" />
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib" />
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib" />
</configuration>

View File

@ -1,25 +1,26 @@
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
<dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
<dllmap os="linux" dll="libX11" target="libX11.so.6"/>
<dllmap os="linux" dll="libXi" target="libXi.so.6"/>
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
<!-- XQuartz compatibility (X11 on Mac) -->
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1" />
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1" />
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1" />
<dllmap os="linux" dll="alut.dll" target="libalut.so.0" />
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so" />
<dllmap os="linux" dll="libX11" target="libX11.so.6" />
<dllmap os="linux" dll="libXi" target="libXi.so.6" />
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0" />
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL" />
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL" />
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib" />
<!-- XQuartz compatibility (X11 on Mac) -->
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib" />
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib" />
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib" />
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib" />
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib" />
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib" />
</configuration>

View File

@ -1,4 +1,5 @@
using System;
using LibVLCSharp.Forms.Shared;
using Xamarin.Forms;
using Xamarin.Forms.Platform.GTK;
using Xamarin.Forms.Platform.GTK.Helpers;
@ -11,7 +12,12 @@ namespace Aurora.gtk
public static void Main(string[] args)
{
Gtk.Application.Init();
Forms.Init();
LibVLCSharpFormsRenderer.Init();
// For some reason, Xamarin does not pick the LibVLCSharp.Form.Platforms.Gtk assembly as a renderer assembly.
// Add it manually.
global::Xamarin.Forms.Forms.Init(new[] { typeof(LibVLCSharp.Forms.Platforms.GTK.VideoViewRenderer).Assembly });
if (PlatformHelper.GetGTKPlatform() == GTKPlatform.Windows)
{

View File

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<stetic-interface>
<configuration>
<images-root-path>..</images-root-path>
</configuration>
<import>
<widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<widget-library name="../../packages/Xamarin.Forms.Platform.GTK.3.6.0.344457/lib/net45/webkit-sharp.dll" />
<widget-library name="../../packages/LibVLCSharp.GTK.3.0.0/lib/net47/LibVLCSharp.GTK.dll" />
<widget-library name="../bin/Debug/Aurora.gtk.exe" internal="true" />
</import>
<widget class="Gtk.Window" id="MainWindow" design-size="400 300">

View File

@ -1,10 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NAudio" version="1.9.0" targetFramework="net47" />
<package id="LibVLCSharp" version="3.0.0" targetFramework="net47" />
<package id="LibVLCSharp.Forms" version="3.0.0" targetFramework="net47" />
<package id="LibVLCSharp.Forms.GTK" version="3.0.0" targetFramework="net47" />
<package id="LibVLCSharp.GTK" version="3.0.0" targetFramework="net47" />
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net47" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net47" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net47" />
<package id="System.Reflection" version="4.3.0" targetFramework="net47" />
<package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net47" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net47" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net47" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net47" />
<package id="taglib-sharp-netstandard2.0" version="2.1.0" targetFramework="net47" />
<package id="VideoLAN.LibVLC.Mac" version="3.1.2" targetFramework="net47" />
<package id="Xamarin.Forms" version="3.6.0.344457" targetFramework="net47" />
<package id="Xamarin.Forms.DataGrid" version="3.1.0" targetFramework="net47" />
<package id="Xamarin.Forms.Platform.GTK" version="3.6.0.344457" targetFramework="net47" />

View File

@ -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">

View File

@ -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
{

View 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();
}
}
}
}

View File

@ -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
}