LibVLC.UWP 没有视频 and/or 音频的 UWP?
UWP with LibVLC.UWP no video and/or audio?
我有一个 UWP 应用程序(目标版本 1903 Build 18362),我想在其中嵌入 VLC 视频播放器。这是我的经历:
- 正在添加 LibVLCSharp 3.3.1
- 正在添加 VideoLAN.LibVLC.UWP 3.2.0
结果:当我捕获事件时,他说他正在缓冲和播放,但没有视频也没有音频。
- 恢复到 VideoLAN.LibVLC.UWP 3.1.1.1
结果:当我捕获他说他正在缓冲和播放的事件时,我听到了音频,但没有视频。
我做错了什么?
MainPage.Xaml:
<Page
x:Class="TestVLCinUWP.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TestVLCinUWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vlc="using:LibVLCSharp.Platforms.UWP"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<vlc:VideoView x:Name="Video" Width="960" Height="540" />
</Grid>
</Page>
MainPage.xaml.cs:
using LibVLCSharp.Shared;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace TestVLCinUWP
{
public sealed partial class MainPage : Page
{
public MainPage()
{
Core.Initialize();
this.InitializeComponent();
Loaded += MainPage_Loaded;
}
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
LibVLC vlc = new LibVLC();
var media = new Media(vlc, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", FromType.FromLocation);
MediaPlayer player = new MediaPlayer(media);
Video.MediaPlayer = player;
player.Play();
}
}
}
请看https://github.com/videolan/libvlcsharp/tree/3.x/Samples/LibVLCSharp.UWP.Sample
使用 LVS 3.x /Libvlc 3.x 中的当前设计,您需要在创建 new LibVLC()
.
时设置交换链选项
至于音频,这是一个已知问题:https://code.videolan.org/videolan/LibVLCSharp/issues/253
我有一个 UWP 应用程序(目标版本 1903 Build 18362),我想在其中嵌入 VLC 视频播放器。这是我的经历:
- 正在添加 LibVLCSharp 3.3.1
- 正在添加 VideoLAN.LibVLC.UWP 3.2.0
结果:当我捕获事件时,他说他正在缓冲和播放,但没有视频也没有音频。
- 恢复到 VideoLAN.LibVLC.UWP 3.1.1.1
结果:当我捕获他说他正在缓冲和播放的事件时,我听到了音频,但没有视频。
我做错了什么?
MainPage.Xaml:
<Page
x:Class="TestVLCinUWP.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TestVLCinUWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vlc="using:LibVLCSharp.Platforms.UWP"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<vlc:VideoView x:Name="Video" Width="960" Height="540" />
</Grid>
</Page>
MainPage.xaml.cs:
using LibVLCSharp.Shared;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace TestVLCinUWP
{
public sealed partial class MainPage : Page
{
public MainPage()
{
Core.Initialize();
this.InitializeComponent();
Loaded += MainPage_Loaded;
}
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
LibVLC vlc = new LibVLC();
var media = new Media(vlc, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", FromType.FromLocation);
MediaPlayer player = new MediaPlayer(media);
Video.MediaPlayer = player;
player.Play();
}
}
}
请看https://github.com/videolan/libvlcsharp/tree/3.x/Samples/LibVLCSharp.UWP.Sample
使用 LVS 3.x /Libvlc 3.x 中的当前设计,您需要在创建 new LibVLC()
.
至于音频,这是一个已知问题:https://code.videolan.org/videolan/LibVLCSharp/issues/253