From ee8f7a05dd0b2f021706bc59c8ea68b7234aa78b Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Fri, 28 Jun 2024 13:03:33 -0400 Subject: [PATCH] Fix ui flicker in dev player --- .../components/VideoPlayerDev/VideoPlayerButton.bs | 11 +++++++++++ .../components/VideoPlayerDev/VideoPlayerButton.xml | 9 +++++++++ .../src/components/VideoPlayerDev/VideoPlayerDev.bs | 4 ++-- .../src/components/VideoPlayerDev/VideoPlayerDev.xml | 3 ++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerButton.bs b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerButton.bs index 317152ea..6f1929d2 100644 --- a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerButton.bs +++ b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerButton.bs @@ -3,6 +3,7 @@ import "pkg:/source/utils/Types.bs" function Init() m.background = m.top.findNode("background") m.icon = m.top.findNode("icon") + m.icon2 = m.top.findNode("icon2") OnDisabledChange() @@ -19,9 +20,11 @@ function OnButtonFocused() if buttonFocused m.background.blendColor = m.top.focusedBackgroundColor m.icon.blendColor = m.top.focusedIconColor + m.icon2.blendColor = m.top.focusedIconColor else m.background.blendColor = m.top.backgroundColor m.icon.blendColor = m.top.iconColor + m.icon2.blendColor = m.top.iconColor end if end function @@ -31,6 +34,7 @@ function OnDisabledChange() if disabled m.background.blendColor = m.top.disabledBackgroundColor m.icon.blendColor = m.top.disabledIconColor + m.icon2.blendColor = m.top.disabledIconColor else OnButtonFocused() end if @@ -52,3 +56,10 @@ function OnkeyEvent(key as string, press as boolean) as boolean return false end function + +function OnToggleStateChange() + toggleState = m.top.toggleState + + m.icon.visible = toggleState + m.icon2.visible = not toggleState +end function diff --git a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerButton.xml b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerButton.xml index 3b4ad788..70ae5a91 100644 --- a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerButton.xml +++ b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerButton.xml @@ -5,6 +5,9 @@ + + + @@ -24,6 +27,12 @@ width="42" height="42"> + + \ No newline at end of file diff --git a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs index fb185cba..987e8a49 100644 --- a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs +++ b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs @@ -170,9 +170,9 @@ end function function OnPlayerStateChange() state = m.top.state if state = "playing" - m.playButton.iconUri = "pkg:/images/icons/player/pause.png" + m.playButton.toggleState = false ' Pause icon else if state = "paused" - m.playButton.iconUri = "pkg:/images/icons/player/play.png" + m.playButton.toggleState = true ' Play icon end if end function diff --git a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.xml b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.xml index 869f6311..8ff6db92 100644 --- a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.xml +++ b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.xml @@ -54,7 +54,8 @@ disabled="true" /> + iconUri="pkg:/images/icons/player/play.png" + iconUri2="pkg:/images/icons/player/pause.png" />