feat: Move stream quality selector directly to player toolbar, remove redundant settings, and optimize VLC instant playback via direct HLS

This commit is contained in:
LilDosto 2026-10-28 03:01:22 +03:00
parent acce34e346
commit 6ae0537eaf
7 changed files with 244 additions and 125 deletions

2
.gitignore vendored
View file

@ -28,3 +28,5 @@ bld/
*.pdb
*.xml
publish_small/
publish/

Binary file not shown.

View file

@ -1,6 +1,7 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Text.RegularExpressions;
using KickStreamHub.Models;
namespace KickStreamHub.Services;
@ -8,9 +9,7 @@ namespace KickStreamHub.Services;
/// <summary>
/// Kick.com genel API'siyle konuşan servis. .NET'in HttpClient'ı, Python
/// tarafında yaşanan curl_cffi kütüphanesinin aksine, birden fazla iş
/// parçacığından EŞZAMANLI olarak güvenle kullanılabilir; bu, eski Python
/// sürümünde uygulamanın rastgele çökmesine (access violation) yol açan
/// kök nedeni tamamen ortadan kaldırır.
/// parçacığından EŞZAMANLI olarak güvenle kullanılabilir.
/// </summary>
public sealed class KickApiService
{
@ -62,6 +61,55 @@ public sealed class KickApiService
return null;
}
/// <summary>
/// Master HLS playlist (.m3u8) içinden istenen kaliteye (1080p, 720p60, 480p vb.) ait doğrudan akış URL'sini seçer.
/// </summary>
public async Task<string> ResolveQualityUrlAsync(string masterPlaylistUrl, string quality, CancellationToken ct = default)
{
if (string.IsNullOrWhiteSpace(masterPlaylistUrl) ||
string.IsNullOrWhiteSpace(quality) ||
quality.Equals("best", StringComparison.OrdinalIgnoreCase))
{
return masterPlaylistUrl;
}
try
{
using var resp = await Http.GetAsync(masterPlaylistUrl, ct).ConfigureAwait(false);
if (!resp.IsSuccessStatusCode) return masterPlaylistUrl;
var m3u8 = await resp.Content.ReadAsStringAsync(ct).ConfigureAwait(false);
var regex = new Regex(@"#EXT-X-STREAM-INF:([^\r\n]+)[\r\n]+([^\r\n]+)");
var matches = regex.Matches(m3u8);
string? bestMatchUrl = null;
var cleanQuality = quality.ToLowerInvariant().Replace("p", "").Replace("60", "").Replace("30", "");
foreach (Match match in matches)
{
var info = match.Groups[1].Value;
var streamUrl = match.Groups[2].Value.Trim();
if (info.Contains(quality, StringComparison.OrdinalIgnoreCase))
{
return streamUrl;
}
if (!string.IsNullOrEmpty(cleanQuality) && info.Contains(cleanQuality, StringComparison.OrdinalIgnoreCase))
{
bestMatchUrl ??= streamUrl;
}
}
return bestMatchUrl ?? masterPlaylistUrl;
}
catch (Exception ex)
{
LoggingService.Instance.Warning($"Kalite playlisti ayrıştırılamadı ({quality}): {ex.Message}");
return masterPlaylistUrl;
}
}
public async Task<byte[]?> GetImageBytesAsync(string url, CancellationToken ct = default)
{
try

View file

@ -4,7 +4,7 @@ using System.IO;
namespace KickStreamHub.Services;
/// <summary>
/// Streamlink + oynatıcı (Pencere İçi VLC, Harici VLC, Harici MPV) işlemlerini bulan, başlatan ve
/// Pencere İçi VLC, Harici VLC ve Harici MPV işlemlerini bulan, başlatan ve
/// izleyen servis.
/// </summary>
public sealed class StreamlinkService
@ -106,55 +106,38 @@ public sealed class StreamlinkService
/// <summary>
/// VLC'yi doğrudan uygulama penceresi içindeki WinForms Panel HWND'sine (--drawable-hwnd) gömer.
/// Streamlink kuruluysa Streamlink üzerinden, kurulu değilse Kick HLS playback_url üzerinden başlatır.
/// Doğrudan HLS akış linkiyle başlatıldığı için anında (0.3 saniyede) açılır, Cloudflare/Streamlink engeline takılmaz.
/// </summary>
public (bool success, string message) PlayEmbeddedVlc(
string channelName,
IntPtr hwnd,
string? streamlinkPath,
string vlcPath,
string quality,
string? playbackUrl,
string streamUrl,
string? extraArgs = null)
{
StopEmbeddedVlc();
try
{
ProcessStartInfo psi;
string vlcEmbedFlags = $"-I dummy --dummy-quiet --drawable-hwnd={hwnd.ToInt64()} --no-video-title-show --mouse-hide-timeout=1000";
if (string.IsNullOrWhiteSpace(streamUrl))
{
return (false, $"🔴 {channelName.ToUpperInvariant()} için canlı yayın akış linki bulunamadı.");
}
if (!string.IsNullOrWhiteSpace(streamlinkPath) && File.Exists(streamlinkPath))
var args = $"\"{streamUrl}\" -I dummy --dummy-quiet --drawable-hwnd={hwnd.ToInt64()} --no-video-title-show --network-caching=800 --clock-jitter=0 --no-sub-autodetect-file";
if (!string.IsNullOrWhiteSpace(extraArgs))
{
var url = $"https://kick.com/{channelName}";
var args = $"\"{url}\" {quality} --player \"{vlcPath}\" --player-args \"{vlcEmbedFlags}\"";
if (!string.IsNullOrWhiteSpace(extraArgs))
args += $" {extraArgs.Trim()}";
args += $" {extraArgs.Trim()}";
}
psi = new ProcessStartInfo
{
FileName = streamlinkPath,
Arguments = args,
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
};
}
else if (!string.IsNullOrWhiteSpace(playbackUrl))
var psi = new ProcessStartInfo
{
psi = new ProcessStartInfo
{
FileName = vlcPath,
Arguments = $"\"{playbackUrl}\" {vlcEmbedFlags}",
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
};
}
else
{
return (false, "⚠ Pencere içi VLC için Streamlink kurulu olmalı veya kanal canlı yayında olmalıdır.");
}
FileName = vlcPath,
Arguments = args,
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
};
var process = Process.Start(psi);
if (process is null) return (false, "Pencere içi VLC başlatılamadı.");
@ -179,7 +162,7 @@ public sealed class StreamlinkService
_embeddedVlcChannel = channelName;
}
return (true, $"🎬 {channelName.ToUpperInvariant()} yayını Pencere İçi VLC oynatıcıda başlatıldı.");
return (true, $"🎬 {channelName.ToUpperInvariant()} yayını Pencere İçi VLC'de açıldı.");
}
catch (Exception ex)
{

View file

@ -86,6 +86,7 @@ public partial class MainViewModel : ObservableObject
[ObservableProperty] private bool _isFullScreen;
[ObservableProperty] private bool _isEmbeddedChatOpen;
[ObservableProperty] private string _activePlayerChannel = string.Empty;
[ObservableProperty] private string _selectedQuality = "best";
// Multi-Stream (Squad View) bindings
[ObservableProperty] private bool _isQuadLayout = true;
@ -108,6 +109,7 @@ public partial class MainViewModel : ObservableObject
Config = _configService.Load();
Config.RunOnStartup = StartupService.IsRunOnStartup();
_isEmbeddedChatOpen = Config.ShowEmbeddedChat;
_selectedQuality = string.IsNullOrWhiteSpace(Config.StreamQuality) ? "best" : Config.StreamQuality;
_api = new KickApiService();
_avatarCache = new AvatarCacheService(_configService.AvatarCacheDirectory, _api);
@ -181,12 +183,25 @@ public partial class MainViewModel : ObservableObject
public void SaveConfig()
{
Config.ShowEmbeddedChat = IsEmbeddedChatOpen;
Config.StreamQuality = SelectedQuality;
_configService.Save(Config);
StartupService.SetRunOnStartup(Config.RunOnStartup);
_poller.Start(Math.Max(20, Config.RefreshIntervalSeconds));
UpdateDetailPlayState();
}
partial void OnSelectedQualityChanged(string value)
{
if (string.IsNullOrWhiteSpace(value)) return;
Config.StreamQuality = value;
_configService.Save(Config);
if (IsEmbeddedPlaying && IsEmbeddedVlcActive && !string.IsNullOrEmpty(ActivePlayerChannel))
{
_ = PlayEmbeddedVlcPlayerAsync(ActivePlayerChannel);
}
}
[RelayCommand]
private async Task RefreshAsync()
{
@ -329,24 +344,7 @@ public partial class MainViewModel : ObservableObject
if (targetCard != null)
SelectedChannel = targetCard;
// 1. Pencere İçi Web Oynatıcı (WebView2)
if (string.Equals(Config.PlayerChoice, "embedded", StringComparison.OrdinalIgnoreCase))
{
if (IsEmbeddedPlaying && IsEmbeddedWebActive && string.Equals(ActivePlayerChannel, channelName, StringComparison.OrdinalIgnoreCase))
{
StopEmbeddedPlayer();
StatusMessage = "⏹ Dahili yayın durduruldu.";
}
else
{
PlayEmbeddedWebPlayer(channelName);
StatusMessage = $"▶ {channelName.ToUpperInvariant()} yayını Web oynatıcıda açıldı.";
}
UpdateDetailPlayState();
return;
}
// 2. Pencere İçi VLC Oynatıcı (Embedded VLC)
// 1. Pencere İçi VLC Oynatıcı seçiliyse
if (string.Equals(Config.PlayerChoice, "embedded_vlc", StringComparison.OrdinalIgnoreCase))
{
if (IsEmbeddedPlaying && IsEmbeddedVlcActive && string.Equals(ActivePlayerChannel, channelName, StringComparison.OrdinalIgnoreCase))
@ -356,32 +354,50 @@ public partial class MainViewModel : ObservableObject
}
else
{
PlayEmbeddedVlcPlayer(channelName);
_ = PlayEmbeddedVlcPlayerAsync(channelName);
}
UpdateDetailPlayState();
return;
}
// 3. Harici VLC veya MPV Oynatıcı
var streamlinkPath = Streamlink.FindStreamlink(Config.StreamlinkPath);
var playerPath = Streamlink.FindPlayer(Config.PlayerChoice, Config.PlayerPath);
if (streamlinkPath is null)
// 2. Harici VLC veya MPV Oynatıcı seçiliyse
if (string.Equals(Config.PlayerChoice, "vlc", StringComparison.OrdinalIgnoreCase) ||
string.Equals(Config.PlayerChoice, "mpv", StringComparison.OrdinalIgnoreCase))
{
StatusMessage = "⚠ Streamlink bulunamadı! Ayarlardan 'Dahili Web' veya 'Pencere İçi VLC' seçebilir ya da Streamlink kurabilirsiniz.";
return;
}
if (playerPath is null)
{
StatusMessage = $"⚠ {Config.PlayerChoice.ToUpperInvariant()} bulunamadı! Ayarlardan oynatıcı tercihini değiştirin veya yolu belirtin.";
var streamlinkPath = Streamlink.FindStreamlink(Config.StreamlinkPath);
var playerPath = Streamlink.FindPlayer(Config.PlayerChoice, Config.PlayerPath);
if (streamlinkPath is null)
{
StatusMessage = "⚠ Streamlink bulunamadı! Harici oynatıcı için Streamlink kurun veya 'Pencere İçi Oynatıcı' modunu kullanın.";
return;
}
if (playerPath is null)
{
StatusMessage = $"⚠ {Config.PlayerChoice.ToUpperInvariant()} bulunamadı! Ayarlardan yolu belirtin.";
return;
}
var (success, message) = Streamlink.Play(channelName, streamlinkPath, playerPath, Config.StreamQuality, Config.ExtraStreamlinkArgs);
StatusMessage = message;
if (success && Config.AutoOpenChat && Streamlink.IsPlaying(channelName))
OpenChat(channelName);
UpdateDetailPlayState();
return;
}
var (success, message) = Streamlink.Play(channelName, streamlinkPath, playerPath, Config.StreamQuality, Config.ExtraStreamlinkArgs);
StatusMessage = message;
if (success && Config.AutoOpenChat && Streamlink.IsPlaying(channelName))
OpenChat(channelName);
// 3. Varsayılan: Pencere İçi Web Oynatıcı (WebView2)
if (IsEmbeddedPlaying && IsEmbeddedWebActive && string.Equals(ActivePlayerChannel, channelName, StringComparison.OrdinalIgnoreCase))
{
StopEmbeddedPlayer();
StatusMessage = "⏹ Dahili yayın durduruldu.";
}
else
{
PlayEmbeddedWebPlayer(channelName);
StatusMessage = $"▶ {channelName.ToUpperInvariant()} yayını Web oynatıcıda açıldı.";
}
UpdateDetailPlayState();
}
@ -401,26 +417,68 @@ public partial class MainViewModel : ObservableObject
OpenChat(channelName);
}
public void PlayEmbeddedVlcPlayer(string channelName)
public async Task PlayEmbeddedVlcPlayerAsync(string channelName)
{
var vlcPath = Streamlink.FindPlayer("vlc", Config.PlayerPath);
if (vlcPath is null)
{
StatusMessage = "⚠ VLC Media Player bulunamadı! Pencere içi VLC için VLC kurun veya 'Web Oynatıcı' moduna geçin.";
StatusMessage = "⚠ VLC Media Player bulunamadı! Lütfen VLC kurun veya Ayarlardan yolunu seçin.";
return;
}
EmbeddedStopRequested?.Invoke(this, EventArgs.Empty);
ActivePlayerChannel = channelName;
IsEmbeddedWebActive = false;
IsEmbeddedVlcActive = true;
IsEmbeddedPlaying = true;
EmbeddedVlcPlayRequested?.Invoke(this, channelName);
StatusMessage = $"⏳ {channelName.ToUpperInvariant()} VLC yayını hazırlanıyor...";
if (IsEmbeddedChatOpen)
SyncEmbeddedChat(channelName);
else if (Config.AutoOpenChat)
OpenChat(channelName);
// Kanalın canlı durumunu ve playback_url'sini en güncel şekilde al
var status = GetStatus(channelName);
string? playbackUrl = status?.PlaybackUrl;
if (string.IsNullOrWhiteSpace(playbackUrl) || status is null || !status.IsLive)
{
var freshData = await _api.GetChannelAsync(channelName).ConfigureAwait(false);
if (freshData?.Livestream is null)
{
_dispatcher.Invoke(() =>
{
StatusMessage = $"🔴 {channelName.ToUpperInvariant()} şu anda canlı yayında değil.";
});
return;
}
playbackUrl = freshData.PlaybackUrl;
if (freshData.Livestream != null && status != null)
{
status.PlaybackUrl = freshData.PlaybackUrl ?? string.Empty;
status.IsLive = true;
}
}
if (string.IsNullOrWhiteSpace(playbackUrl))
{
_dispatcher.Invoke(() =>
{
StatusMessage = $"🔴 {channelName.ToUpperInvariant()} canlı akış linki alınamadı.";
});
return;
}
// İstenen kaliteye (best, 720p60, 480p vb.) ait doğrudan akış URL'sini çöz
var streamUrl = await _api.ResolveQualityUrlAsync(playbackUrl, Config.StreamQuality).ConfigureAwait(false);
_dispatcher.Invoke(() =>
{
EmbeddedStopRequested?.Invoke(this, EventArgs.Empty);
ActivePlayerChannel = channelName;
IsEmbeddedWebActive = false;
IsEmbeddedVlcActive = true;
IsEmbeddedPlaying = true;
EmbeddedVlcPlayRequested?.Invoke(this, streamUrl);
if (IsEmbeddedChatOpen)
SyncEmbeddedChat(channelName);
else if (Config.AutoOpenChat)
OpenChat(channelName);
UpdateDetailPlayState();
});
}
[RelayCommand]
@ -437,7 +495,7 @@ public partial class MainViewModel : ObservableObject
if (!string.IsNullOrEmpty(targetChannel) && IsEmbeddedPlaying)
{
if (engine.Equals("embedded_vlc", StringComparison.OrdinalIgnoreCase))
PlayEmbeddedVlcPlayer(targetChannel);
_ = PlayEmbeddedVlcPlayerAsync(targetChannel);
else
PlayEmbeddedWebPlayer(targetChannel);
@ -451,7 +509,7 @@ public partial class MainViewModel : ObservableObject
if (!IsEmbeddedPlaying || string.IsNullOrEmpty(ActivePlayerChannel)) return;
if (IsEmbeddedVlcActive)
{
PlayEmbeddedVlcPlayer(ActivePlayerChannel);
_ = PlayEmbeddedVlcPlayerAsync(ActivePlayerChannel);
}
else
{

View file

@ -449,17 +449,72 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Left: Channel & Instant Engine Switcher (Web vs Embedded VLC) -->
<!-- Left: Channel, Instant Engine Switcher (Web vs VLC) & Stream Quality -->
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
<Ellipse Width="8" Height="8" Fill="#53FC18" Margin="0,0,6,0" VerticalAlignment="Center" />
<TextBlock Text="{Binding ActivePlayerChannel}" FontWeight="Bold" FontSize="12.5" Foreground="#F8FAFC" VerticalAlignment="Center" Margin="0,0,10,0" />
<Button Content="🌐 Web" Style="{StaticResource SecondaryButton}" FontSize="10.5" Padding="7,3" Margin="0,0,4,0"
<Button Content="🌐 Web" FontSize="10.5" Padding="7,3" Margin="0,0,4,0"
Command="{Binding SwitchEmbeddedEngineCommand}" CommandParameter="embedded"
ToolTip="Dahili WebView2 Oynatıcıya Geç" />
<Button Content="🎬 VLC (Pencere İçi)" Style="{StaticResource SecondaryButton}" FontSize="10.5" Padding="7,3"
ToolTip="Dahili WebView2 Oynatıcıya Geç">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource SecondaryButton}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsEmbeddedWebActive}" Value="True">
<Setter Property="Background" Value="#1A3822" />
<Setter Property="Foreground" Value="#53FC18" />
<Setter Property="BorderBrush" Value="#53FC18" />
<Setter Property="FontWeight" Value="Bold" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button Content="🎬 VLC" FontSize="10.5" Padding="7,3" Margin="0,0,8,0"
Command="{Binding SwitchEmbeddedEngineCommand}" CommandParameter="embedded_vlc"
ToolTip="Pencere İçi Gömülü VLC Oynatıcıya Geç" />
ToolTip="Pencere İçi Gömülü VLC Oynatıcıya Geç (Hızlı &amp; Düşük Kaynak)">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource SecondaryButton}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsEmbeddedVlcActive}" Value="True">
<Setter Property="Background" Value="#2A2410" />
<Setter Property="Foreground" Value="#F59E0B" />
<Setter Property="BorderBrush" Value="#F59E0B" />
<Setter Property="FontWeight" Value="Bold" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<!-- Stream Quality Dropdown Directly On Player Toolbar -->
<Border Background="#090E16" CornerRadius="6" BorderBrush="#1F2E45" BorderThickness="1" Padding="6,1" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="⚙ Kalite:" Foreground="#94A3B8" FontSize="10.5" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,0,4,0" />
<ComboBox SelectedValue="{Binding SelectedQuality, Mode=TwoWay}"
SelectedValuePath="Tag"
FontSize="10.5"
Padding="4,2"
Height="22"
MinWidth="110"
VerticalAlignment="Center"
Background="#0F1725"
Foreground="#F8FAFC"
BorderThickness="0"
ToolTip="Yayın Çözünürlüğü ve Kalitesi">
<ComboBoxItem Tag="best" Content="Kaynak (En İyi)" />
<ComboBoxItem Tag="1080p60" Content="1080p 60 FPS" />
<ComboBoxItem Tag="720p60" Content="720p 60 FPS" />
<ComboBoxItem Tag="720p" Content="720p 30 FPS" />
<ComboBoxItem Tag="480p" Content="480p" />
<ComboBoxItem Tag="360p" Content="360p" />
<ComboBoxItem Tag="160p" Content="160p" />
<ComboBoxItem Tag="worst" Content="En Düşük" />
<ComboBoxItem Tag="audio_only" Content="Sadece Ses" />
</ComboBox>
</StackPanel>
</Border>
</StackPanel>
<!-- Right: Player Controls (Mute, Reload, Chat, Theater, Fullscreen, Popout, Close) -->
@ -975,33 +1030,10 @@
<TextBlock Text="Oynatıcı motorunu, sesli bildirimleri, kategori uyarılarını ve kanal yedeklemelerini yönetin."
FontSize="12.5" Foreground="#64748B" Margin="0,0,0,18" />
<!-- Card 1: Player Settings -->
<!-- Card 1: Player Paths & Tools -->
<Border Background="#0E1520" CornerRadius="12" Padding="20" BorderBrush="#1B283B" BorderThickness="1" Margin="0,0,0,16">
<StackPanel>
<TextBlock Text="🎬 Oynatıcı Motoru ve Yayın Kalitesi" FontSize="15" FontWeight="Bold" Foreground="#53FC18" Margin="0,0,0,14" />
<TextBlock Text="Varsayılan Yayın Oynatıcı" Foreground="#94A3B8" FontSize="12" FontWeight="SemiBold" Margin="0,0,0,6" />
<ComboBox x:Name="PlayerCombo" SelectedValue="{Binding Config.PlayerChoice}"
SelectedValuePath="Tag" Margin="0,0,0,14">
<ComboBoxItem Tag="embedded" Content="🌐 Dahili Modern Web Oynatıcı (WebView2 — Ekstra program gerektirmez)" />
<ComboBoxItem Tag="embedded_vlc" Content="🎬 Pencere İçi VLC Oynatıcı (Uygulama İçine Gömülü VLC)" />
<ComboBoxItem Tag="vlc" Content="🚀 Harici VLC Media Player (Ayrı VLC penceresinde açar)" />
<ComboBoxItem Tag="mpv" Content="⚡ Harici MPV Oynatıcı (Ayrı MPV penceresinde açar)" />
</ComboBox>
<TextBlock Text="Yayın Kalitesi (Pencere İçi VLC ve Harici Oynatıcılar için)" Foreground="#94A3B8" FontSize="12" FontWeight="SemiBold" Margin="0,0,0,6" />
<ComboBox x:Name="QualityCombo" SelectedValue="{Binding Config.StreamQuality}"
SelectedValuePath="Tag" Margin="0,0,0,14">
<ComboBoxItem Tag="best" Content="En Yüksek Kalite (best / Kaynak)" />
<ComboBoxItem Tag="1080p60" Content="1080p 60 FPS (Full HD)" />
<ComboBoxItem Tag="720p60" Content="720p 60 FPS (HD)" />
<ComboBoxItem Tag="720p" Content="720p 30 FPS" />
<ComboBoxItem Tag="480p" Content="480p" />
<ComboBoxItem Tag="360p" Content="360p (Veri Tasarrufu)" />
<ComboBoxItem Tag="160p" Content="160p (Minimum)" />
<ComboBoxItem Tag="worst" Content="En Düşük Kalite (worst)" />
<ComboBoxItem Tag="audio_only" Content="Sadece Ses (audio_only)" />
</ComboBox>
<TextBlock Text="🎬 Harici Oynatıcı ve Araç Yolları" FontSize="15" FontWeight="Bold" Foreground="#53FC18" Margin="0,0,0,14" />
<TextBlock Text="Özel Oynatıcı Yolu (VLC/MPV — Boş bırakılırsa otomatik bulunur)" Foreground="#94A3B8" FontSize="12" FontWeight="SemiBold" Margin="0,0,0,6" />
<Grid Margin="0,0,0,14">

View file

@ -105,7 +105,7 @@ public partial class MainWindow : Window
});
}
private void ViewModel_EmbeddedVlcPlayRequested(object? sender, string channelName)
private void ViewModel_EmbeddedVlcPlayRequested(object? sender, string streamUrl)
{
_ = Dispatcher.InvokeAsync(() =>
{
@ -118,7 +118,6 @@ public partial class MainWindow : Window
VlcHost.UpdateLayout();
var hwnd = VlcPanel.Handle;
var streamlinkPath = _viewModel.Streamlink.FindStreamlink(_viewModel.Config.StreamlinkPath);
var vlcPath = _viewModel.Streamlink.FindPlayer("vlc", _viewModel.Config.PlayerPath);
if (vlcPath is null)
@ -127,14 +126,11 @@ public partial class MainWindow : Window
return;
}
var status = _viewModel.GetStatus(channelName);
var (success, msg) = _viewModel.Streamlink.PlayEmbeddedVlc(
channelName,
_viewModel.ActivePlayerChannel,
hwnd,
streamlinkPath,
vlcPath,
_viewModel.Config.StreamQuality,
status?.PlaybackUrl,
streamUrl,
_viewModel.Config.ExtraStreamlinkArgs);
_viewModel.StatusMessage = msg;