58 lines
2.1 KiB
C#
58 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace VideoPlayer
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
[DllImport("Kernel32")]
|
|
public static extern void AllocConsole();
|
|
|
|
[DllImport("Kernel32")]
|
|
public static extern void FreeConsole();
|
|
|
|
public MainWindow()
|
|
{
|
|
AllocConsole();
|
|
Console.WriteLine("Hello");
|
|
Console.WriteLine("Current dir: {0}", Directory.GetCurrentDirectory());
|
|
InitializeComponent();
|
|
myControl.MediaPlayer.VlcLibDirectoryNeeded += OnVlcControlNeedsLibDirectory;
|
|
myControl.MediaPlayer.EndInit();
|
|
myControl.MediaPlayer.Play(new Uri("https://u.wut.ee/leekima.webm"));
|
|
}
|
|
|
|
private void OnVlcControlNeedsLibDirectory(object sender, Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs e)
|
|
{
|
|
var currentAssembly = Assembly.GetEntryAssembly();
|
|
var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
|
|
if (currentDirectory == null)
|
|
return;
|
|
Console.WriteLine("fromvlc: currentdir: {0}", currentDirectory);
|
|
if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
|
|
e.VlcLibDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, @"..\..\..\lib\x86\"));
|
|
else
|
|
e.VlcLibDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, @"..\..\lib\x64\"));
|
|
Console.WriteLine(e.VlcLibDirectory);
|
|
}
|
|
}
|
|
}
|