Commit ad2cef3 1 parent 4d9df90 commit ad2cef3 Copy full SHA for ad2cef3
File tree 3 files changed +8
-9
lines changed
src/Desktop/BiliCopilot.UI
ViewModels/Core/NativePlayerViewModel
3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,12 @@ protected async override void OnControlLoaded()
31
31
/// <inheritdoc/>
32
32
protected override void OnApplyTemplate ( )
33
33
{
34
- _playerElement = GetTemplateChild ( "PlayerElement" ) as MediaPlayerElement ;
34
+ var rootGrid = GetTemplateChild ( "RootGrid" ) as Grid ;
35
+ _playerElement = new MediaPlayerElement ( ) ;
36
+ _playerElement . HorizontalAlignment = HorizontalAlignment . Stretch ;
37
+ _playerElement . VerticalAlignment = VerticalAlignment . Stretch ;
38
+ _playerElement . AreTransportControlsEnabled = false ;
39
+ rootGrid . Children . Add ( _playerElement ) ;
35
40
}
36
41
37
42
/// <inheritdoc/>
Original file line number Diff line number Diff line change 91
91
<Setter Property =" Template" >
92
92
<Setter .Value>
93
93
<ControlTemplate TargetType =" local:NativePlayer" >
94
- <Grid Background =" Black" >
95
- <MediaPlayerElement
96
- x : Name =" PlayerElement"
97
- HorizontalAlignment =" Stretch"
98
- VerticalAlignment =" Stretch"
99
- AreTransportControlsEnabled =" False" />
100
- </Grid >
94
+ <Grid x : Name =" RootGrid" Background =" Black" />
101
95
</ControlTemplate >
102
96
</Setter .Value>
103
97
</Setter >
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ protected override async Task OnLoadPlayDataAsync()
140
140
await LoadDashVideoSourceAsync ( ) ;
141
141
}
142
142
143
- _element . SetMediaPlayer ( Player ) ;
143
+ _element ? . SetMediaPlayer ( Player ) ;
144
144
}
145
145
146
146
/// <inheritdoc/>
You can’t perform that action at this time.
0 commit comments