Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure loading spinner activates for queue items #1503

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/manager/QueueManager.bs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ sub playQueue()
nextItemMediaType = getItemType(nextItem)
if nextItemMediaType = "" then return

startLoadingSpinner()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we can cancel something, we call startLoadingSpinner directly, as this is just aesthetic. if we can't cancel the thing, then we use startMediaLoadingSpinner(), because that one eats backpresses until stopLoadingSpinner() is called.


if nextItemMediaType = "audio"
CreateAudioPlayerView()
return
Expand Down Expand Up @@ -149,6 +151,8 @@ sub playQueue()
CreateVideoPlayerView()
return
end if

stopLoadingSpinner()
end sub

' Remove item at end of play queue
Expand Down
2 changes: 2 additions & 0 deletions components/manager/ViewCreator.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
sub CreateAudioPlayerView()
m.view = CreateObject("roSGNode", "AudioPlayerView")
m.view.observeField("state", "onStateChange")
stopLoadingSpinner()
m.global.sceneManager.callFunc("pushScene", m.view)
end sub

Expand All @@ -25,6 +26,7 @@ sub CreateVideoPlayerView()
m.getPlaybackInfoTask.videoID = mediaSourceId
m.getPlaybackInfoTask.observeField("data", "onPlaybackInfoLoaded")

stopLoadingSpinner()
m.global.sceneManager.callFunc("pushScene", m.view)
end sub

Expand Down
6 changes: 6 additions & 0 deletions source/utils/misc.bs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ function toString(input) as string
end function

sub startLoadingSpinner()
if not isValid(m.scene)
m.scene = m.top.getScene()
end if
m.spinner = createObject("roSGNode", "Spinner")
m.spinner.translation = "[900, 450]"
m.spinner.visible = true
Expand All @@ -467,6 +470,9 @@ sub startMediaLoadingSpinner()
end sub

sub stopLoadingSpinner()
if not isValid(m.scene)
m.scene = m.top.getScene()
end if
if isValid(m.spinner)
m.spinner.visible = false
end if
Expand Down