尝试使用LibVLC(VLCdotnet)和MediaPlayer / Audio / All属性播放视频会出现此错误。有人遇到过这样的事情吗?任何帮助将不胜感激。
'(((Vlc.DotNet.Core.AudioOutputsManagement)(((Vlc.DotNet.Core.AudioManagement)mediaPlayer.Audio).Outputs).All'引发了类型为'System.Runtime.InteropServices.MarshalDirectiveException'的异常'>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
FileInfo file = new FileInfo(@"E:\Statisfying.mp4");
var currentDirectory = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
// Default installation path of VideoLAN.LibVLC.Windows
var libDirectory =
new DirectoryInfo("C:\\Program Files (x86)\\VideoLAN\\VLC");
using (var mediaPlayer = new Vlc.DotNet.Core.VlcMediaPlayer(libDirectory))
{
var mediaOptions = new[]
{
":sout =#transcode{vcodec=theo,vb=800,acodec=vorb,ab=128,channels=2,samplerate=44100,scodec=none}:http{mux=ogg,dst=:8080/}",
":sout-all",
":sout-keep"
};
mediaPlayer.SetMedia(file, mediaOptions);
mediaPlayer.Play();
Console.WriteLine("Streaming on http://localhost:8080");
Console.WriteLine("Press any key to exit");
}
}
}
答案 0 :(得分:0)
您可以尝试使用Vlc.DotNet 3.0吗? (在撰写本文时仍是预发行版)。
3.0版进行了许多改进和错误修正。