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:
parent
acce34e346
commit
6ae0537eaf
7 changed files with 244 additions and 125 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -28,3 +28,5 @@ bld/
|
||||||
*.pdb
|
*.pdb
|
||||||
*.xml
|
*.xml
|
||||||
publish_small/
|
publish_small/
|
||||||
|
|
||||||
|
publish/
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using KickStreamHub.Models;
|
using KickStreamHub.Models;
|
||||||
|
|
||||||
namespace KickStreamHub.Services;
|
namespace KickStreamHub.Services;
|
||||||
|
|
@ -8,9 +9,7 @@ namespace KickStreamHub.Services;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kick.com genel API'siyle konuşan servis. .NET'in HttpClient'ı, Python
|
/// 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ş
|
/// 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
|
/// parçacığından EŞZAMANLI olarak güvenle kullanılabilir.
|
||||||
/// sürümünde uygulamanın rastgele çökmesine (access violation) yol açan
|
|
||||||
/// kök nedeni tamamen ortadan kaldırır.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class KickApiService
|
public sealed class KickApiService
|
||||||
{
|
{
|
||||||
|
|
@ -62,6 +61,55 @@ public sealed class KickApiService
|
||||||
return null;
|
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)
|
public async Task<byte[]?> GetImageBytesAsync(string url, CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ using System.IO;
|
||||||
namespace KickStreamHub.Services;
|
namespace KickStreamHub.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <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.
|
/// izleyen servis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class StreamlinkService
|
public sealed class StreamlinkService
|
||||||
|
|
@ -106,55 +106,38 @@ public sealed class StreamlinkService
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// VLC'yi doğrudan uygulama penceresi içindeki WinForms Panel HWND'sine (--drawable-hwnd) gömer.
|
/// 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>
|
/// </summary>
|
||||||
public (bool success, string message) PlayEmbeddedVlc(
|
public (bool success, string message) PlayEmbeddedVlc(
|
||||||
string channelName,
|
string channelName,
|
||||||
IntPtr hwnd,
|
IntPtr hwnd,
|
||||||
string? streamlinkPath,
|
|
||||||
string vlcPath,
|
string vlcPath,
|
||||||
string quality,
|
string streamUrl,
|
||||||
string? playbackUrl,
|
|
||||||
string? extraArgs = null)
|
string? extraArgs = null)
|
||||||
{
|
{
|
||||||
StopEmbeddedVlc();
|
StopEmbeddedVlc();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProcessStartInfo psi;
|
if (string.IsNullOrWhiteSpace(streamUrl))
|
||||||
string vlcEmbedFlags = $"-I dummy --dummy-quiet --drawable-hwnd={hwnd.ToInt64()} --no-video-title-show --mouse-hide-timeout=1000";
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(streamlinkPath) && File.Exists(streamlinkPath))
|
|
||||||
{
|
{
|
||||||
var url = $"https://kick.com/{channelName}";
|
return (false, $"🔴 {channelName.ToUpperInvariant()} için canlı yayın akış linki bulunamadı.");
|
||||||
var args = $"\"{url}\" {quality} --player \"{vlcPath}\" --player-args \"{vlcEmbedFlags}\"";
|
}
|
||||||
|
|
||||||
|
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))
|
if (!string.IsNullOrWhiteSpace(extraArgs))
|
||||||
args += $" {extraArgs.Trim()}";
|
|
||||||
|
|
||||||
psi = new ProcessStartInfo
|
|
||||||
{
|
{
|
||||||
FileName = streamlinkPath,
|
args += $" {extraArgs.Trim()}";
|
||||||
|
}
|
||||||
|
|
||||||
|
var psi = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = vlcPath,
|
||||||
Arguments = args,
|
Arguments = args,
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
};
|
};
|
||||||
}
|
|
||||||
else if (!string.IsNullOrWhiteSpace(playbackUrl))
|
|
||||||
{
|
|
||||||
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.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var process = Process.Start(psi);
|
var process = Process.Start(psi);
|
||||||
if (process is null) return (false, "Pencere içi VLC başlatılamadı.");
|
if (process is null) return (false, "Pencere içi VLC başlatılamadı.");
|
||||||
|
|
@ -179,7 +162,7 @@ public sealed class StreamlinkService
|
||||||
_embeddedVlcChannel = channelName;
|
_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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ public partial class MainViewModel : ObservableObject
|
||||||
[ObservableProperty] private bool _isFullScreen;
|
[ObservableProperty] private bool _isFullScreen;
|
||||||
[ObservableProperty] private bool _isEmbeddedChatOpen;
|
[ObservableProperty] private bool _isEmbeddedChatOpen;
|
||||||
[ObservableProperty] private string _activePlayerChannel = string.Empty;
|
[ObservableProperty] private string _activePlayerChannel = string.Empty;
|
||||||
|
[ObservableProperty] private string _selectedQuality = "best";
|
||||||
|
|
||||||
// Multi-Stream (Squad View) bindings
|
// Multi-Stream (Squad View) bindings
|
||||||
[ObservableProperty] private bool _isQuadLayout = true;
|
[ObservableProperty] private bool _isQuadLayout = true;
|
||||||
|
|
@ -108,6 +109,7 @@ public partial class MainViewModel : ObservableObject
|
||||||
Config = _configService.Load();
|
Config = _configService.Load();
|
||||||
Config.RunOnStartup = StartupService.IsRunOnStartup();
|
Config.RunOnStartup = StartupService.IsRunOnStartup();
|
||||||
_isEmbeddedChatOpen = Config.ShowEmbeddedChat;
|
_isEmbeddedChatOpen = Config.ShowEmbeddedChat;
|
||||||
|
_selectedQuality = string.IsNullOrWhiteSpace(Config.StreamQuality) ? "best" : Config.StreamQuality;
|
||||||
|
|
||||||
_api = new KickApiService();
|
_api = new KickApiService();
|
||||||
_avatarCache = new AvatarCacheService(_configService.AvatarCacheDirectory, _api);
|
_avatarCache = new AvatarCacheService(_configService.AvatarCacheDirectory, _api);
|
||||||
|
|
@ -181,12 +183,25 @@ public partial class MainViewModel : ObservableObject
|
||||||
public void SaveConfig()
|
public void SaveConfig()
|
||||||
{
|
{
|
||||||
Config.ShowEmbeddedChat = IsEmbeddedChatOpen;
|
Config.ShowEmbeddedChat = IsEmbeddedChatOpen;
|
||||||
|
Config.StreamQuality = SelectedQuality;
|
||||||
_configService.Save(Config);
|
_configService.Save(Config);
|
||||||
StartupService.SetRunOnStartup(Config.RunOnStartup);
|
StartupService.SetRunOnStartup(Config.RunOnStartup);
|
||||||
_poller.Start(Math.Max(20, Config.RefreshIntervalSeconds));
|
_poller.Start(Math.Max(20, Config.RefreshIntervalSeconds));
|
||||||
UpdateDetailPlayState();
|
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]
|
[RelayCommand]
|
||||||
private async Task RefreshAsync()
|
private async Task RefreshAsync()
|
||||||
{
|
{
|
||||||
|
|
@ -329,9 +344,50 @@ public partial class MainViewModel : ObservableObject
|
||||||
if (targetCard != null)
|
if (targetCard != null)
|
||||||
SelectedChannel = targetCard;
|
SelectedChannel = targetCard;
|
||||||
|
|
||||||
// 1. Pencere İçi Web Oynatıcı (WebView2)
|
// 1. Pencere İçi VLC Oynatıcı seçiliyse
|
||||||
if (string.Equals(Config.PlayerChoice, "embedded", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(Config.PlayerChoice, "embedded_vlc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
if (IsEmbeddedPlaying && IsEmbeddedVlcActive && string.Equals(ActivePlayerChannel, channelName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
StopEmbeddedPlayer();
|
||||||
|
StatusMessage = "⏹ Pencere içi VLC yayını durduruldu.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ = PlayEmbeddedVlcPlayerAsync(channelName);
|
||||||
|
}
|
||||||
|
UpdateDetailPlayState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Harici VLC veya MPV Oynatıcı seçiliyse
|
||||||
|
if (string.Equals(Config.PlayerChoice, "vlc", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(Config.PlayerChoice, "mpv", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Varsayılan: Pencere İçi Web Oynatıcı (WebView2)
|
||||||
if (IsEmbeddedPlaying && IsEmbeddedWebActive && string.Equals(ActivePlayerChannel, channelName, StringComparison.OrdinalIgnoreCase))
|
if (IsEmbeddedPlaying && IsEmbeddedWebActive && string.Equals(ActivePlayerChannel, channelName, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
StopEmbeddedPlayer();
|
StopEmbeddedPlayer();
|
||||||
|
|
@ -343,46 +399,6 @@ public partial class MainViewModel : ObservableObject
|
||||||
StatusMessage = $"▶ {channelName.ToUpperInvariant()} yayını Web oynatıcıda açıldı.";
|
StatusMessage = $"▶ {channelName.ToUpperInvariant()} yayını Web oynatıcıda açıldı.";
|
||||||
}
|
}
|
||||||
UpdateDetailPlayState();
|
UpdateDetailPlayState();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Pencere İçi VLC Oynatıcı (Embedded VLC)
|
|
||||||
if (string.Equals(Config.PlayerChoice, "embedded_vlc", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
if (IsEmbeddedPlaying && IsEmbeddedVlcActive && string.Equals(ActivePlayerChannel, channelName, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
StopEmbeddedPlayer();
|
|
||||||
StatusMessage = "⏹ Pencere içi VLC yayını durduruldu.";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlayEmbeddedVlcPlayer(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)
|
|
||||||
{
|
|
||||||
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.";
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayEmbeddedWebPlayer(string channelName)
|
public void PlayEmbeddedWebPlayer(string channelName)
|
||||||
|
|
@ -401,26 +417,68 @@ public partial class MainViewModel : ObservableObject
|
||||||
OpenChat(channelName);
|
OpenChat(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayEmbeddedVlcPlayer(string channelName)
|
public async Task PlayEmbeddedVlcPlayerAsync(string channelName)
|
||||||
{
|
{
|
||||||
var vlcPath = Streamlink.FindPlayer("vlc", Config.PlayerPath);
|
var vlcPath = Streamlink.FindPlayer("vlc", Config.PlayerPath);
|
||||||
if (vlcPath is null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusMessage = $"⏳ {channelName.ToUpperInvariant()} VLC yayını hazırlanıyor...";
|
||||||
|
|
||||||
|
// 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);
|
EmbeddedStopRequested?.Invoke(this, EventArgs.Empty);
|
||||||
ActivePlayerChannel = channelName;
|
ActivePlayerChannel = channelName;
|
||||||
IsEmbeddedWebActive = false;
|
IsEmbeddedWebActive = false;
|
||||||
IsEmbeddedVlcActive = true;
|
IsEmbeddedVlcActive = true;
|
||||||
IsEmbeddedPlaying = true;
|
IsEmbeddedPlaying = true;
|
||||||
EmbeddedVlcPlayRequested?.Invoke(this, channelName);
|
EmbeddedVlcPlayRequested?.Invoke(this, streamUrl);
|
||||||
|
|
||||||
if (IsEmbeddedChatOpen)
|
if (IsEmbeddedChatOpen)
|
||||||
SyncEmbeddedChat(channelName);
|
SyncEmbeddedChat(channelName);
|
||||||
else if (Config.AutoOpenChat)
|
else if (Config.AutoOpenChat)
|
||||||
OpenChat(channelName);
|
OpenChat(channelName);
|
||||||
|
|
||||||
|
UpdateDetailPlayState();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
|
|
@ -437,7 +495,7 @@ public partial class MainViewModel : ObservableObject
|
||||||
if (!string.IsNullOrEmpty(targetChannel) && IsEmbeddedPlaying)
|
if (!string.IsNullOrEmpty(targetChannel) && IsEmbeddedPlaying)
|
||||||
{
|
{
|
||||||
if (engine.Equals("embedded_vlc", StringComparison.OrdinalIgnoreCase))
|
if (engine.Equals("embedded_vlc", StringComparison.OrdinalIgnoreCase))
|
||||||
PlayEmbeddedVlcPlayer(targetChannel);
|
_ = PlayEmbeddedVlcPlayerAsync(targetChannel);
|
||||||
else
|
else
|
||||||
PlayEmbeddedWebPlayer(targetChannel);
|
PlayEmbeddedWebPlayer(targetChannel);
|
||||||
|
|
||||||
|
|
@ -451,7 +509,7 @@ public partial class MainViewModel : ObservableObject
|
||||||
if (!IsEmbeddedPlaying || string.IsNullOrEmpty(ActivePlayerChannel)) return;
|
if (!IsEmbeddedPlaying || string.IsNullOrEmpty(ActivePlayerChannel)) return;
|
||||||
if (IsEmbeddedVlcActive)
|
if (IsEmbeddedVlcActive)
|
||||||
{
|
{
|
||||||
PlayEmbeddedVlcPlayer(ActivePlayerChannel);
|
_ = PlayEmbeddedVlcPlayerAsync(ActivePlayerChannel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -449,17 +449,72 @@
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</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">
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
<Ellipse Width="8" Height="8" Fill="#53FC18" Margin="0,0,6,0" 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" />
|
<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"
|
Command="{Binding SwitchEmbeddedEngineCommand}" CommandParameter="embedded"
|
||||||
ToolTip="Dahili WebView2 Oynatıcıya Geç" />
|
ToolTip="Dahili WebView2 Oynatıcıya Geç">
|
||||||
<Button Content="🎬 VLC (Pencere İçi)" Style="{StaticResource SecondaryButton}" FontSize="10.5" Padding="7,3"
|
<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"
|
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ı & 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>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Right: Player Controls (Mute, Reload, Chat, Theater, Fullscreen, Popout, Close) -->
|
<!-- 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."
|
<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" />
|
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">
|
<Border Background="#0E1520" CornerRadius="12" Padding="20" BorderBrush="#1B283B" BorderThickness="1" Margin="0,0,0,16">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="🎬 Oynatıcı Motoru ve Yayın Kalitesi" FontSize="15" FontWeight="Bold" Foreground="#53FC18" Margin="0,0,0,14" />
|
<TextBlock Text="🎬 Harici Oynatıcı ve Araç Yolları" 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="Özel Oynatıcı Yolu (VLC/MPV — Boş bırakılırsa otomatik bulunur)" Foreground="#94A3B8" FontSize="12" FontWeight="SemiBold" Margin="0,0,0,6" />
|
<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">
|
<Grid Margin="0,0,0,14">
|
||||||
|
|
|
||||||
|
|
@ -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(() =>
|
_ = Dispatcher.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
|
|
@ -118,7 +118,6 @@ public partial class MainWindow : Window
|
||||||
|
|
||||||
VlcHost.UpdateLayout();
|
VlcHost.UpdateLayout();
|
||||||
var hwnd = VlcPanel.Handle;
|
var hwnd = VlcPanel.Handle;
|
||||||
var streamlinkPath = _viewModel.Streamlink.FindStreamlink(_viewModel.Config.StreamlinkPath);
|
|
||||||
var vlcPath = _viewModel.Streamlink.FindPlayer("vlc", _viewModel.Config.PlayerPath);
|
var vlcPath = _viewModel.Streamlink.FindPlayer("vlc", _viewModel.Config.PlayerPath);
|
||||||
|
|
||||||
if (vlcPath is null)
|
if (vlcPath is null)
|
||||||
|
|
@ -127,14 +126,11 @@ public partial class MainWindow : Window
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var status = _viewModel.GetStatus(channelName);
|
|
||||||
var (success, msg) = _viewModel.Streamlink.PlayEmbeddedVlc(
|
var (success, msg) = _viewModel.Streamlink.PlayEmbeddedVlc(
|
||||||
channelName,
|
_viewModel.ActivePlayerChannel,
|
||||||
hwnd,
|
hwnd,
|
||||||
streamlinkPath,
|
|
||||||
vlcPath,
|
vlcPath,
|
||||||
_viewModel.Config.StreamQuality,
|
streamUrl,
|
||||||
status?.PlaybackUrl,
|
|
||||||
_viewModel.Config.ExtraStreamlinkArgs);
|
_viewModel.Config.ExtraStreamlinkArgs);
|
||||||
|
|
||||||
_viewModel.StatusMessage = msg;
|
_viewModel.StatusMessage = msg;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue