Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lindexi_gd
Uno
提交
d76f2699
U
Uno
项目概览
lindexi_gd
/
Uno
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
Uno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d76f2699
编写于
6月 16, 2023
作者:
X
xiaoy312
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: changes based from review
上级
7d6b051b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
130 addition
and
87 deletion
+130
-87
src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.MediaPlayer.cs
.../MediaPlayerElement/MediaTransportControls.MediaPlayer.cs
+42
-28
src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs
...aml/Controls/MediaPlayerElement/MediaTransportControls.cs
+88
-59
未找到文件。
src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.MediaPlayer.cs
浏览文件 @
d76f2699
...
...
@@ -106,19 +106,21 @@ namespace Windows.UI.Xaml.Controls
m_isBuffering
=
currentState
==
MediaPlaybackState
.
Buffering
;
#if !HAS_UNO
// If playing state changed, toggle position timer
// to avoid ticking if position is not updating
//if (previousIsPlaying != m_isPlaying)
//{
// if (m_isPlaying)
// {
// StartPositionUpdateTimer();
// }
// else
// {
// StopPositionUpdateTimer();
// }
//}
if
(
previousIsPlaying
!=
m_isPlaying
)
{
if
(
m_isPlaying
)
{
StartPositionUpdateTimer
();
}
else
{
StopPositionUpdateTimer
();
}
}
#endif
if
((
previousIsPlaying
!=
m_isPlaying
||
previousIsBuffering
!=
m_isBuffering
)
&&
!
m_isInScrubMode
)
{
if
((
m_isPlaying
&&
!
m_isBuffering
||
m_shouldDismissControlPanel
)
/*&& !m_isthruScrubber*/
)
...
...
@@ -131,17 +133,19 @@ namespace Windows.UI.Xaml.Controls
ShowControlPanel
();
}
}
//if (!m_isPlaying)
//{
// IFC(ResetTrickMode());
//}
//// Timing issues still Natural duration values zero even after source loaded.
//if (m_sourceLoaded && m_naturalDuration.TimeSpan.Duration == 0)
//{
// wf::TimeSpan value;
// IFC(spPlaybackSession->get_NaturalDuration(&value));
// m_naturalDuration.TimeSpan = value;
//}
#if !HAS_UNO
if
(!
m_isPlaying
)
{
IFC
(
ResetTrickMode
());
}
// Timing issues still Natural duration values zero even after source loaded.
if
(
m_sourceLoaded
&&
m_naturalDuration
.
TimeSpan
.
Duration
==
0
)
{
wf
::
TimeSpan
value
;
IFC
(
spPlaybackSession
->
get_NaturalDuration
(&
value
));
m_naturalDuration
.
TimeSpan
=
value
;
}
#endif
UpdateVisualState
();
}
}
...
...
@@ -413,13 +417,18 @@ namespace Windows.UI.Xaml.Controls
{
if
(
m_transportControlsEnabled
&&
_mediaPlayer
is
{
})
{
if
(
//!m_isAudioOnly &&
//!IsLiveContent() &&
if
(
#if !HAS_UNO
!
m_isAudioOnly
&&
!
IsLiveContent
()
&&
#endif
!
m_isInScrubMode
)
{
m_currentPlaybackRate
=
_mediaPlayer
.
PlaybackSession
.
PlaybackRate
;
_mediaPlayer
.
PlaybackSession
.
PlaybackRate
=
0
;
//IFC(EnableValueChangedEventThrottlingOnSliderAutomation(false));
#if !HAS_UNO
EnableValueChangedEventThrottlingOnSliderAutomation
(
false
);
#endif
m_isInScrubMode
=
true
;
}
}
...
...
@@ -429,12 +438,17 @@ namespace Windows.UI.Xaml.Controls
{
if
(
m_transportControlsEnabled
&&
_mediaPlayer
is
{
})
{
if
(
//!m_isAudioOnly &&
//!IsLiveContent() &&
if
(
#if !HAS_UNO
!
m_isAudioOnly
&&
!
IsLiveContent
()
&&
#endif
m_isInScrubMode
)
{
_mediaPlayer
.
PlaybackSession
.
PlaybackRate
=
m_currentPlaybackRate
;
//EnableValueChangedEventThrottlingOnSliderAutomation(true);
#if !HAS_UNO
EnableValueChangedEventThrottlingOnSliderAutomation
(
true
);
#endif
m_isInScrubMode
=
false
;
}
}
...
...
src/Uno.UI/UI/Xaml/Controls/MediaPlayerElement/MediaTransportControls.cs
浏览文件 @
d76f2699
...
...
@@ -246,8 +246,10 @@ namespace Windows.UI.Xaml.Controls
Bind
(
m_tpControlPanelGrid
,
x
=>
x
.
PointerEntered
+=
OnControlPanelEntered
,
x
=>
x
.
PointerExited
-=
OnControlPanelEntered
);
Bind
(
m_tpControlPanelGrid
,
x
=>
x
.
PointerExited
+=
OnControlPanelExited
,
x
=>
x
.
PointerExited
-=
OnControlPanelExited
);
Bind
(
m_tpControlPanelGrid
,
x
=>
x
.
PointerCaptureLost
+=
OnControlPanelCaptureLost
,
x
=>
x
.
PointerCaptureLost
-=
OnControlPanelCaptureLost
);
//Bind(m_tpControlPanelGrid, x => x.GotFocus += OnControlPanelGotFocus, x => x.GotFocus -= OnControlPanelGotFocus);
//Bind(m_tpControlPanelGrid, x => x.LostFocus += OnControlPanelLostFocus, x => x.LostFocus -= OnControlPanelLostFocus);
#if !HAS_UNO
Bind
(
m_tpControlPanelGrid
,
x
=>
x
.
GotFocus
+=
OnControlPanelGotFocus
,
x
=>
x
.
GotFocus
-=
OnControlPanelGotFocus
);
Bind
(
m_tpControlPanelGrid
,
x
=>
x
.
LostFocus
+=
OnControlPanelLostFocus
,
x
=>
x
.
LostFocus
-=
OnControlPanelLostFocus
);
#endif
BindSizeChanged
(
_controlPanelBorder
,
ControlPanelBorderSizeChanged
);
// Interactive parts of MTC, but outside of MediaControlsCommandBar:
...
...
@@ -257,8 +259,10 @@ namespace Windows.UI.Xaml.Controls
BindButtonClick
(
m_tpTHLeftSidePlayPauseButton
,
PlayPause
);
// MediaControlsCommandBar\PrimaryCommands:
//BindButtonClick(m_tpCCSelectionButton, null);
//BindButtonClick(m_tpTHAudioTrackSelectionButton, null);
#if !HAS_UNO
BindButtonClick
(
m_tpCCSelectionButton
,
null
);
BindButtonClick
(
m_tpTHAudioTrackSelectionButton
,
null
);
#endif
// --- LeftSeparator ---
BindButtonClick
(
m_tpStopButton
,
Stop
);
BindButtonClick
(
m_tpSkipBackwardButton
,
SkipBackward
);
...
...
@@ -271,7 +275,9 @@ namespace Windows.UI.Xaml.Controls
// --- RightSeparator ---
BindButtonClick
(
m_tpRepeatButton
,
RepeatButtonTapped
);
BindButtonClick
(
m_tpZoomButton
,
ZoomButtonTapped
);
//BindButtonClick(m_tpCastButton, null);
#if !HAS_UNO
BindButtonClick
(
m_tpCastButton
,
null
);
#endif
BindButtonClick
(
m_tpCompactOverlayButton
,
UpdateCompactOverlayMode
);
BindButtonClick
(
m_tpFullWindowButton
,
FullWindowButtonTapped
);
...
...
@@ -431,23 +437,29 @@ namespace Windows.UI.Xaml.Controls
if
(!
m_controlPanelIsVisible
)
{
m_controlPanelIsVisible
=
true
;
//if (!m_isVSStateChangeExternal) // Skip if Visual State already happen through external
//{
// m_controlPanelVisibilityChanged = TRUE;
//}
#if !HAS_UNO
if
(!
m_isVSStateChangeExternal
)
// Skip if Visual State already happen through external
{
m_controlPanelVisibilityChanged
=
TRUE
;
}
#endif
}
//ShowControlPanelFromMPE();
#if !HAS_UNO
ShowControlPanelFromMPE
();
// Resume position updates now that CP is visible
//IFC(StartPositionUpdateTimer());
StartPositionUpdateTimer
();
#endif
// Immediately start the timer to hide control panel
StartControlPanelHideTimer
();
UpdateVisualState
();
//m_isVSStateChangeExternal = FALSE;
#if !HAS_UNO
m_isVSStateChangeExternal
=
FALSE
;
#endif
#if HAS_UNO
// Adjust layout bounds immediately
...
...
@@ -465,6 +477,8 @@ namespace Windows.UI.Xaml.Controls
{
// Both CP and Vertical Volume will be hiddden, so stop their hide timers.
StopControlPanelHideTimer
();
#if !HAS_UNO
//IFC(StopVerticalVolumeHideTimer());
// Stop position updates now that CP is not visible
...
...
@@ -477,23 +491,28 @@ namespace Windows.UI.Xaml.Controls
// m_verticalVolumeIsVisible = FALSE;
// m_verticalVolumeVisibilityChanged = TRUE;
//}
#endif
// Flag control panel itself to hide
m_controlPanelIsVisible
=
false
;
#if !HAS_UNO
//if (!m_isVSStateChangeExternal) // Skip if Visual State already happen through external
//{
// m_controlPanelVisibilityChanged = TRUE;
//}
//HideControlPanelFromMPE();
#endif
UpdateVisualState
();
}
}
m_shouldDismissControlPanel
=
false
;
#if !HAS_UNO
//m_isthruScrubber = false;
//m_isVSStateChangeExternal = false;
#endif
}
}
public
void
Show
()
=>
ShowControlPanel
();
...
...
@@ -523,7 +542,7 @@ namespace Windows.UI.Xaml.Controls
{
if
(
m_tpCastButton
is
{
})
{
#if
false // not implemented
#if
!HAS_UNO
var
deviceSelector
=
CastingDevice
.
GetDeviceSelector
(
CastingPlaybackTypes
.
Audio
|
CastingPlaybackTypes
.
Video
|
...
...
@@ -590,10 +609,15 @@ namespace Windows.UI.Xaml.Controls
if
(
m_transportControlsEnabled
)
{
// Check flags to minimize work in this frquently called handler
if
(
//!m_isAudioOnly &&
if
(
#if !HAS_UNO
!
m_isAudioOnly
&&
#endif
!
m_controlPanelIsVisible
&&
ShowAndHideAutomatically
/* ignore if when auto hide/show is disabled */
// && !m_hasError
#if !HAS_UNO
&&
!
m_hasError
#endif
)
{
ShowControlPanel
();
...
...
@@ -964,43 +988,45 @@ namespace Windows.UI.Xaml.Controls
// visual states
private
void
InitializeVisualState
()
{
//if (MTCParent_MediaElement == m_parentType)
//{
// IFC(InitializeVisualStateFromME());
//}
//else if (MTCParent_MediaPlayerElement == m_parentType)
//{
// IFC(InitializeVisualStateFromMPE());
//}
//IFC(InitializeVolume());
//if (MTCParent_MediaElement == m_parentType)
//{
// // Make sure we have the latest playback item
// IFC(UpdatePlaybackItemReference());
//}
//IFC(UpdateRepeatButtonUI());
// Update UI
//IFC(UpdatePlayPauseUI());
//IFC(UpdateFullWindowUI());
//IFC(UpdatePositionUI());
//IFC(UpdateDownloadProgressUI());
//IFC(UpdateErrorUI());
//if (m_tpMediaPositionSlider)
//{
// IFC(m_tpMediaPositionSlider.Cast<Slider>()->get_Minimum(&m_positionSliderMinimum));
// IFC(m_tpMediaPositionSlider.Cast<Slider>()->get_Maximum(&m_positionSliderMaximum));
//}
//// We could have switched into or out of audio mode, which changes the controls that are displayed.
//IFC(UpdateAudioSelectionUI());
//IFC(UpdateIsMutedUI());
//IFC(UpdateVolumeUI());
//IFC(CalculateDropOutLevel());
#if !HAS_UNO
if
(
MTCParent_MediaElement
==
m_parentType
)
{
IFC
(
InitializeVisualStateFromME
());
}
else
if
(
MTCParent_MediaPlayerElement
==
m_parentType
)
{
IFC
(
InitializeVisualStateFromMPE
());
}
IFC
(
InitializeVolume
());
if
(
MTCParent_MediaElement
==
m_parentType
)
{
// Make sure we have the latest playback item
IFC
(
UpdatePlaybackItemReference
());
}
IFC
(
UpdateRepeatButtonUI
());
Update
UI
IFC
(
UpdatePlayPauseUI
());
IFC
(
UpdateFullWindowUI
());
IFC
(
UpdatePositionUI
());
IFC
(
UpdateDownloadProgressUI
());
IFC
(
UpdateErrorUI
());
if
(
m_tpMediaPositionSlider
)
{
IFC
(
m_tpMediaPositionSlider
.
Cast
<
Slider
>()->
get_Minimum
(&
m_positionSliderMinimum
));
IFC
(
m_tpMediaPositionSlider
.
Cast
<
Slider
>()->
get_Maximum
(&
m_positionSliderMaximum
));
}
// We could have switched into or out of audio mode, which changes the controls that are displayed.
IFC
(
UpdateAudioSelectionUI
());
IFC
(
UpdateIsMutedUI
());
IFC
(
UpdateVolumeUI
());
IFC
(
CalculateDropOutLevel
());
#endif
// ShowControlPanel() calls UpdateVisualState()
ShowControlPanel
();
...
...
@@ -1172,15 +1198,18 @@ namespace Windows.UI.Xaml.Controls
var
isAutoShowHide
=
ShowAndHideAutomatically
;
var
result
=
m_controlPanelIsVisible
&&
//!m_isAudioOnly &&
//!m_hasError &&
#if !HAS_UNO
!
m_isAudioOnly
&&
!
m_hasError
&&
#endif
(
m_shouldDismissControlPanel
||
!
m_controlPanelHasPointerOver
)
&&
!
m_rootHasPointerPressed
&&
#if !HAS_UNO
// Do not need to check this on the Xbox only if commandbar should exist in the template.
(!
m_controlsHaveKeyOrProgFocus
||
(
XboxUtility
::
IsOnXbox
()
&&
m_tpCommandBar
.
Get
()))
&&
//// Do not need to check this on the Xbox only if commandbar should exist in the template.
//(!m_controlsHaveKeyOrProgFocus || (XboxUtility::IsOnXbox() && m_tpCommandBar.Get())) &&
//!m_verticalVolumeHasKeyOrProgFocus &&
!
m_verticalVolumeHasKeyOrProgFocus
&&
#endif
ShouldHideControlPanelWhilePlaying
()
&&
!
m_isFlyoutOpen
&&
!
m_isPointerMove
&&
...
...
@@ -1204,7 +1233,7 @@ namespace Windows.UI.Xaml.Controls
/// <summary>
/// Helper to hit test pElement against point.
/// </summary>
bool
HitTestHelper
(
Point
point
,
UIElement
?
pElement
)
private
bool
HitTestHelper
(
Point
point
,
UIElement
?
pElement
)
{
if
(
pElement
is
{
})
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录