Full screen hint (#264)
This commit is contained in:
1 parent
7796c63291
commit
e6302e48fe
3 files changed
+63
-1
No files matched your search
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A hint on how to restore video to full screen
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Bookmarks are now added to the top of the list
|
- Bookmarks are now added to the top of the list
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ import "pkg:/source/utils/Logging.bs"
|
|||||||
function Init()
|
function Init()
|
||||||
SetPlayerStyle()
|
SetPlayerStyle()
|
||||||
SetupAnimation()
|
SetupAnimation()
|
||||||
|
m.fullScreenHint = m.top.findNode("fullScreenHint")
|
||||||
|
m.fullScreenHintLabel = m.top.findNode("fullScreenHintLabel")
|
||||||
|
m.fullScreenHintTimer = m.top.findNode("fullScreenHintTimer")
|
||||||
|
m.fullScreenHintTimer.ObserveField("fire", FuncName(OnFullScreenHintTimer))
|
||||||
|
|
||||||
' videoPlayingSuccess indicates if we started playing a video successfully
|
' videoPlayingSuccess indicates if we started playing a video successfully
|
||||||
' We use it to detect if we should try another link for a video, or if another error
|
' We use it to detect if we should try another link for a video, or if another error
|
||||||
@@ -33,14 +37,20 @@ function Init()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
rect = m.container.fullscreen ? m.top.maxRect : m.top.minRect
|
minRect = m.top.minRect
|
||||||
|
rect = m.container.fullscreen ? m.top.maxRect : minRect
|
||||||
|
|
||||||
m.top.width = rect.width
|
m.top.width = rect.width
|
||||||
m.top.height = rect.height
|
m.top.height = rect.height
|
||||||
m.top.translation = [rect.x, rect.y]
|
m.top.translation = [rect.x, rect.y]
|
||||||
|
|
||||||
|
m.fullScreenHint.width = minRect.width
|
||||||
|
m.fullScreenHintLabel.width = minRect.width
|
||||||
|
m.fullScreenHint.translation = [0, minRect.height - m.fullScreenHint.height]
|
||||||
|
|
||||||
' TODO:P2 show a loading spinner if video is loading minimized
|
' TODO:P2 show a loading spinner if video is loading minimized
|
||||||
m.top.enableUI = m.container.fullscreen
|
m.top.enableUI = m.container.fullscreen
|
||||||
|
m.top.showFullScreenHint = not m.container.fullscreen
|
||||||
|
|
||||||
m.container.observeFieldScoped("fullscreen", FuncName(OnFullScreenChange))
|
m.container.observeFieldScoped("fullscreen", FuncName(OnFullScreenChange))
|
||||||
m.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
m.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
||||||
@@ -319,6 +329,34 @@ function OnFullScreenChange()
|
|||||||
m.minimizeAnimation.control = "start"
|
m.minimizeAnimation.control = "start"
|
||||||
|
|
||||||
m.top.enableUI = m.container.fullscreen
|
m.top.enableUI = m.container.fullscreen
|
||||||
|
m.top.showFullScreenHint = not m.container.fullscreen
|
||||||
|
|
||||||
SponsorBlock.SetVisible(m.notifications, m.container.fullscreen)
|
SponsorBlock.SetVisible(m.notifications, m.container.fullscreen)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function OnShowFullScreenHint() as void
|
||||||
|
m.fullScreenHintTimer.control = "stop"
|
||||||
|
|
||||||
|
if m.container.fullscreen
|
||||||
|
m.fullScreenHint.visible = false
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if m.top.showFullScreenHint
|
||||||
|
' Take 1 second until the shrink animation finishes to show the hint
|
||||||
|
m.fullScreenHintTimer.duration = 1
|
||||||
|
else
|
||||||
|
' Wait 5 seconds then hide the hint
|
||||||
|
m.fullScreenHintTimer.duration = 5
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.fullScreenHintTimer.control = "start"
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnFullScreenHintTimer()
|
||||||
|
showFullScreenHint = m.top.showFullScreenHint
|
||||||
|
m.fullScreenHint.visible = showFullScreenHint
|
||||||
|
if showFullScreenHint
|
||||||
|
m.top.showFullScreenHint = false
|
||||||
|
end if
|
||||||
|
end function
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
<field id="minRect" type="rect2D" value="[834,460,426,240]" />
|
<field id="minRect" type="rect2D" value="[834,460,426,240]" />
|
||||||
<field id="maxRect" type="rect2D" value="[0,0,1280,720]" />
|
<field id="maxRect" type="rect2D" value="[0,0,1280,720]" />
|
||||||
<field id="chapter" type="string" alias="chapterLabel.text" />
|
<field id="chapter" type="string" alias="chapterLabel.text" />
|
||||||
|
<field id="showFullScreenHint" type="boolean" alwaysNotify="true" onChange="OnShowFullScreenHint" />
|
||||||
<function name="PlayWithContent" />
|
<function name="PlayWithContent" />
|
||||||
<function name="Close" />
|
<function name="Close" />
|
||||||
</interface>
|
</interface>
|
||||||
@@ -43,5 +44,24 @@
|
|||||||
key="[0.0, 0.5, 1.0]"
|
key="[0.0, 0.5, 1.0]"
|
||||||
fieldToInterp="VideoPlayer.translation" />
|
fieldToInterp="VideoPlayer.translation" />
|
||||||
</Animation>
|
</Animation>
|
||||||
|
<Rectangle
|
||||||
|
id="fullScreenHint"
|
||||||
|
height="26"
|
||||||
|
color="0x000000"
|
||||||
|
opacity="0.8"
|
||||||
|
visible="false">
|
||||||
|
<Label
|
||||||
|
id="fullScreenHintLabel"
|
||||||
|
text="Press Options (*) for full screen"
|
||||||
|
height="26"
|
||||||
|
color="0xFFFFFF"
|
||||||
|
horizAlign="center"
|
||||||
|
vertAlign="center"
|
||||||
|
font="font:SmallestSystemFont"
|
||||||
|
/>
|
||||||
|
<Timer
|
||||||
|
id="fullScreenHintTimer"
|
||||||
|
duration="5" />
|
||||||
|
</Rectangle>
|
||||||
</children>
|
</children>
|
||||||
</component>
|
</component>
|
||||||
Reference in new issue
Block a user