diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d79d5fa..146fcf03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support for web request body parsing - Error dialog for video load fail - SponsorBlock sections and category info +- Loading spinner ### Fixed - Bug where playing and exiting a video too quickly would cause the video to play in the background. diff --git a/src/components/LoadingIndicator/LoadingIndicator.bs b/src/components/LoadingIndicator/LoadingIndicator.bs new file mode 100644 index 00000000..c859b2b6 --- /dev/null +++ b/src/components/LoadingIndicator/LoadingIndicator.bs @@ -0,0 +1,26 @@ +function Init() + m.busySpinner = m.top.findNode("busySpinner") + m.busyspinner.poster.width = 150 + m.busyspinner.poster.height = 150 + m.busyspinner.poster.observeField("loadStatus", "PositionSpinner") + m.busySpinner.poster.uri = "pkg:/images/spinner.png" + m.top.observeField("visible", "OnVisibleChange") +end function + +function PositionSpinner() + if m.busyspinner.poster.loadStatus = "ready" + centerx = (1280 - m.busyspinner.poster.width) / 2 + centery = (720 - m.busyspinner.poster.height) / 2 + m.busyspinner.translation = [centerx, centery] + m.busyspinner.visible = true + end if +end function + +function OnVisibleChange() + m.busyspinner.visible = m.top.visible + if m.busyspinner.visible + m.busyspinner.control = "start" + else + m.busyspinner.control = "stop" + end if +end function diff --git a/src/components/LoadingIndicator/LoadingIndicator.xml b/src/components/LoadingIndicator/LoadingIndicator.xml index f1312ac0..ca45c737 100644 --- a/src/components/LoadingIndicator/LoadingIndicator.xml +++ b/src/components/LoadingIndicator/LoadingIndicator.xml @@ -6,17 +6,11 @@ width="1280" height="720" color="#000000" - opacity="0.5" - > -