From 6d511ebb824b2678ad0e2dbbbd08f44e1e3d9911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B1=B3?= Date: Mon, 24 Jun 2024 07:36:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9B=B4=E6=92=AD=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E5=90=8E=E6=92=AD=E6=94=BE=E5=99=A8=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Desktop/Views/Windows/VlcPlayWindow.xaml.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Desktop/Views/Windows/VlcPlayWindow.xaml.cs b/Desktop/Views/Windows/VlcPlayWindow.xaml.cs index 1f14ea13..b34a9212 100644 --- a/Desktop/Views/Windows/VlcPlayWindow.xaml.cs +++ b/Desktop/Views/Windows/VlcPlayWindow.xaml.cs @@ -226,10 +226,21 @@ await Task.Run(() => CancellationTokenSource cts = new CancellationTokenSource(); Task task = Task.Run(() => { - var media = new Media(_libVLC, Url, FromType.FromLocation); - - _mediaPlayer.Media = media; - _mediaPlayer.Play(); + if (_libVLC != null && !string.IsNullOrEmpty(Url)) + { + var media = new Media(_libVLC, Url, FromType.FromLocation); + + _mediaPlayer.Media = media; + _mediaPlayer?.Play(); + } + else + { + vlcPlayModels.MessageVisibility = Visibility.Visible; + vlcPlayModels.OnPropertyChanged("MessageVisibility"); + vlcPlayModels.MessageText = "直播间已下拨获取地址失败,如需更新请右键刷新"; + vlcPlayModels.OnPropertyChanged("MessageText"); + return; + } }, cts.Token); if (!task.Wait(TimeSpan.FromSeconds(10)))