-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 支持外部播放器播放 * add placeholder
- Loading branch information
Showing
33 changed files
with
688 additions
and
48 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/Desktop/BiliCopilot.UI.Models/Constants/ExternalPlayerType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Bili Copilot. All rights reserved. | ||
|
||
namespace BiliCopilot.UI.Models.Constants; | ||
|
||
/// <summary> | ||
/// 外部播放器类型. | ||
/// </summary> | ||
public enum ExternalPlayerType | ||
{ | ||
/// <summary> | ||
/// MPV 播放器. | ||
/// </summary> | ||
Mpv, | ||
|
||
/// <summary> | ||
/// MPV.NET 播放器. | ||
/// </summary> | ||
MpvNet, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,9 @@ public enum PlayerType | |
/// MPV 播放器. | ||
/// </summary> | ||
Mpv, | ||
|
||
/// <summary> | ||
/// 外部播放器. | ||
/// </summary> | ||
External, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/Desktop/BiliCopilot.UI/Controls/Core/Player/ExternalPlayer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Bili Copilot. All rights reserved. | ||
|
||
using BiliCopilot.UI.ViewModels.Core; | ||
using Richasy.WinUI.Share.Base; | ||
|
||
namespace BiliCopilot.UI.Controls.Core; | ||
|
||
/// <summary> | ||
/// 外部播放器. | ||
/// </summary> | ||
public sealed class ExternalPlayer : LayoutControlBase<ExternalPlayerViewModel> | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
src/Desktop/BiliCopilot.UI/Controls/Core/TransportControl/ExternalTransportControl.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<local:PlayerControlBase | ||
x:Class="BiliCopilot.UI.Controls.Core.ExternalTransportControl" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:ext="using:BiliCopilot.UI.Extensions" | ||
xmlns:ic="using:FluentIcons.WinUI" | ||
xmlns:local="using:BiliCopilot.UI.Controls.Core" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d"> | ||
|
||
<Grid | ||
Margin="12,0" | ||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" | ||
CornerRadius="{StaticResource ControlCornerRadius}"> | ||
<Grid Padding="12,8"> | ||
<Grid ColumnSpacing="8"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition /> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
<Grid> | ||
<ProgressRing | ||
Width="38" | ||
Height="38" | ||
VerticalAlignment="Center" | ||
IsActive="{x:Bind ViewModel.IsBuffering, Mode=OneWay}" | ||
Visibility="{x:Bind ViewModel.IsBuffering, Mode=OneWay}" /> | ||
<Grid | ||
Width="36" | ||
Height="36" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}" | ||
BorderThickness="2" | ||
CornerRadius="18"> | ||
<Grid> | ||
<ic:SymbolIcon | ||
FontSize="14" | ||
IconVariant="Filled" | ||
Symbol="Play" | ||
Visibility="{x:Bind ViewModel.IsPaused, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" /> | ||
<ic:SymbolIcon | ||
FontSize="14" | ||
IconVariant="Filled" | ||
Symbol="Pause" | ||
Visibility="{x:Bind ViewModel.IsPaused, Converter={StaticResource BoolToVisibilityReverseConverter}, Mode=OneWay}" /> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
|
||
<ContentControl | ||
x:Name="LeftPanel" | ||
Grid.Column="1" | ||
Content="{x:Bind LeftContent, Mode=OneWay}" | ||
Style="{StaticResource AppContentControlStyle}" /> | ||
<TextBlock | ||
Grid.Column="2" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<Run FontWeight="Bold" Text="{x:Bind ViewModel.Position, Converter={StaticResource DurationConverter}, Mode=OneWay}" /> | ||
<Run Text="/" /> | ||
<Run Text="{x:Bind ViewModel.Duration, Converter={StaticResource DurationConverter}, Mode=OneWay}" /> | ||
</TextBlock> | ||
<Button | ||
Grid.Column="3" | ||
VerticalAlignment="Center" | ||
Command="{x:Bind ViewModel.ReloadCommand, Mode=OneWay}" | ||
Style="{StaticResource CircleIconButtonStyle}" | ||
ToolTipService.ToolTip="{ext:Locale Name=Reload}"> | ||
<ic:SymbolIcon FontSize="14" Symbol="ArrowSync" /> | ||
</Button> | ||
<ContentControl | ||
x:Name="RightPanel" | ||
Grid.Column="4" | ||
Content="{x:Bind RightContent, Mode=OneWay}" | ||
Style="{StaticResource AppContentControlStyle}" /> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</local:PlayerControlBase> |
44 changes: 44 additions & 0 deletions
44
src/Desktop/BiliCopilot.UI/Controls/Core/TransportControl/ExternalTransportControl.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Bili Copilot. All rights reserved. | ||
|
||
namespace BiliCopilot.UI.Controls.Core; | ||
|
||
/// <summary> | ||
/// 外部播放器控件. | ||
/// </summary> | ||
public sealed partial class ExternalTransportControl : PlayerControlBase | ||
{ | ||
/// <summary> | ||
/// <see cref="LeftContent"/> 的依赖属性. | ||
/// </summary> | ||
public static readonly DependencyProperty LeftContentProperty = | ||
DependencyProperty.Register(nameof(LeftContent), typeof(object), typeof(VideoTransportControl), new PropertyMetadata(default)); | ||
|
||
/// <summary> | ||
/// <see cref="RightContent"/> 的依赖属性. | ||
/// </summary> | ||
public static readonly DependencyProperty RightContentProperty = | ||
DependencyProperty.Register(nameof(RightContent), typeof(object), typeof(VideoTransportControl), new PropertyMetadata(default)); | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ExternalTransportControl"/> class. | ||
/// </summary> | ||
public ExternalTransportControl() => InitializeComponent(); | ||
|
||
/// <summary> | ||
/// 左侧内容. | ||
/// </summary> | ||
public object LeftContent | ||
{ | ||
get => (object)GetValue(LeftContentProperty); | ||
set => SetValue(LeftContentProperty, value); | ||
} | ||
|
||
/// <summary> | ||
/// 右侧内容. | ||
/// </summary> | ||
public object RightContent | ||
{ | ||
get => (object)GetValue(RightContentProperty); | ||
set => SetValue(RightContentProperty, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/Desktop/BiliCopilot.UI/Converters/ExternalPlayerTypeConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Bili Copilot. All rights reserved. | ||
|
||
using BiliCopilot.UI.Models.Constants; | ||
using Microsoft.UI.Xaml.Data; | ||
|
||
namespace BiliCopilot.UI.Converters; | ||
|
||
internal sealed class ExternalPlayerTypeConverter : IValueConverter | ||
{ | ||
/// <inheritdoc/> | ||
public object Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
var result = string.Empty; | ||
if (value is ExternalPlayerType type) | ||
{ | ||
switch (type) | ||
{ | ||
case ExternalPlayerType.Mpv: | ||
result = "MPV"; | ||
break; | ||
case ExternalPlayerType.MpvNet: | ||
result = "MPV.NET"; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.