Fix music album loop function
This commit is contained in:
parent
943e0d84ab
commit
d04456ee36
|
@ -106,5 +106,6 @@ sub onStateChange()
|
|||
|
||||
' Playback completed, return user to previous screen
|
||||
m.global.sceneManager.callFunc("popScene")
|
||||
m.global.audioPlayer.loopMode = ""
|
||||
end if
|
||||
end sub
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="AudioPlayer" extends="Audio">
|
||||
<interface>
|
||||
<field id="loopMode" type="string" value="" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="AudioPlayer.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
|
||||
</component>
|
||||
|
|
|
@ -11,7 +11,6 @@ sub init()
|
|||
m.playlistTypeCount = m.global.queueManager.callFunc("getQueueUniqueTypes").count()
|
||||
|
||||
m.shuffleEnabled = false
|
||||
m.loopMode = ""
|
||||
m.buttonCount = m.buttons.getChildCount()
|
||||
|
||||
m.screenSaverTimeout = 300
|
||||
|
@ -203,7 +202,7 @@ sub audioStateChanged()
|
|||
' Song Finished, attempt to move to next song
|
||||
if m.global.audioPlayer.state = "finished"
|
||||
' User has enabled single song loop, play current song again
|
||||
if m.loopMode = "one"
|
||||
if m.global.audioPlayer.loopMode = "one"
|
||||
playAction()
|
||||
return
|
||||
end if
|
||||
|
@ -214,7 +213,7 @@ sub audioStateChanged()
|
|||
' We are at the end of the song queue
|
||||
|
||||
' User has enabled loop for entire song queue, move back to first song
|
||||
if m.loopMode = "all"
|
||||
if m.global.audioPlayer.loopMode = "all"
|
||||
m.global.queueManager.callFunc("setPosition", -1)
|
||||
LoadNextSong()
|
||||
return
|
||||
|
@ -264,21 +263,30 @@ end function
|
|||
|
||||
function loopClicked() as boolean
|
||||
|
||||
if m.loopMode = ""
|
||||
m.loopIndicator.opacity = "1"
|
||||
m.loopIndicator.uri = m.loopIndicator.uri.Replace("-off", "-on")
|
||||
m.loopMode = "all"
|
||||
else if m.loopMode = "all"
|
||||
m.loopIndicator.uri = m.loopIndicator.uri.Replace("-on", "1-on")
|
||||
m.loopMode = "one"
|
||||
if m.global.audioPlayer.loopMode = ""
|
||||
m.global.audioPlayer.loopMode = "all"
|
||||
else if m.global.audioPlayer.loopMode = "all"
|
||||
m.global.audioPlayer.loopMode = "one"
|
||||
else
|
||||
m.loopIndicator.uri = m.loopIndicator.uri.Replace("1-on", "-off")
|
||||
m.loopMode = ""
|
||||
m.global.audioPlayer.loopMode = ""
|
||||
end if
|
||||
|
||||
setLoopButtonImage()
|
||||
|
||||
return true
|
||||
end function
|
||||
|
||||
sub setLoopButtonImage()
|
||||
if m.global.audioPlayer.loopMode = "all"
|
||||
m.loopIndicator.opacity = "1"
|
||||
m.loopIndicator.uri = m.loopIndicator.uri.Replace("-off", "-on")
|
||||
else if m.global.audioPlayer.loopMode = "one"
|
||||
m.loopIndicator.uri = m.loopIndicator.uri.Replace("-on", "1-on")
|
||||
else
|
||||
m.loopIndicator.uri = m.loopIndicator.uri.Replace("1-on", "-off")
|
||||
end if
|
||||
end sub
|
||||
|
||||
function nextClicked() as boolean
|
||||
if m.playlistTypeCount > 1 then return false
|
||||
|
||||
|
@ -408,6 +416,7 @@ sub loadButtons()
|
|||
m.shuffleIndicator.opacity = ".4"
|
||||
m.loopIndicator.opacity = ".4"
|
||||
m.displayButtonsAnimation.control = "start"
|
||||
setLoopButtonImage()
|
||||
end if
|
||||
end sub
|
||||
|
||||
|
@ -522,6 +531,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
|||
return playAction()
|
||||
else if key = "back"
|
||||
m.global.audioPlayer.control = "stop"
|
||||
m.global.audioPlayer.loopMode = ""
|
||||
else if key = "rewind"
|
||||
return previousClicked()
|
||||
else if key = "fastforward"
|
||||
|
|
Loading…
Reference in New Issue
Block a user