I have been trying to add an audio pause button for my channel that is based off of the video player example in the sdk. I added code to try and make a pause button show up after the audio is played Can anyone help me get this audio pause button working properly? Any help would be greatly appreciated. ![]()
I added this code to my AppDetail.brs
screen.ClearButtons()
If showlist[showindex].contenttype<> “Audio” then
if regread(show.contentid) <> invalid and regread(show.contentid).toint() >=30 then
screen.AddButton(1, “Resume playing”)
screen.AddButton(2, “Play from beginning”)
else
screen.addbutton(2,“Play”)
end if
screen.SetContent(show)
screen.Show()
else
if m.isplaying=true and not m.ispaused then
screen.addbutton(3,“Pause”)
screen.addbutton(4,“Stop”)
else if m.isplaying and m.ispaused then
screen.addbutton(5,“Resume”)
screen.addbutton(4,“Stop”)
else if not m.isplaying then
screen.addbutton(2,“Play”)
end if
end if
Here is my appDetailScreen.brs:
if validateParam(show, “roAssociativeArray”, “getPrevShow”) = false return -1
return prevIndex
End Function
this is my appMain.brs:
)
canvas.Show()
Main()
End Sub
'********************************************************************
'** Video Player Example Application - Main
'** November 2009
'** Copyright (c) 2009 Roku Inc. All Rights Reserved.
'********************************************************************
Sub Main()
'initialize theme attributes like titles, logos and overhang color
initTheme()
'prepare the screen for display and get ready to begin
screen=preShowHomeScreen(“”, “”)
if screen=invalid then
print “unexpected error in preShowHomeScreen”
return
end if
'set to go, time to get started
m.isplaying=false
m.ispaused=false
showHomeScreen(screen)
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'** Theme attributes affect the branding of the application
'** and are artwork, colors and offsets specific to the app
'*************************************************************
Sub initTheme()
app = CreateObject(“roAppManager”)
theme = CreateObject(“roAssociativeArray”)
theme.OverhangOffsetSD_X = “50”
theme.OverhangOffsetSD_Y = “38”
theme.OverhangSliceSD = “pkg:/images/jbsoverhangsliceSD.jpg”
theme.OverhangLogoSD = “pkg:/images/jbsoverhanglogoSD.jpg”
theme.OverhangOffsetHD_X = “35”
theme.OverhangOffsetHD_Y = “35”
theme.OverhangSliceHD = “pkg:/images/jbsoverhangsliceHD.jpg”
theme.OverhangLogoHD = “pkg:/images/jbsoverhanglogoHD.jpg”
theme.BackgroundColor = “#000000”
app.SetTheme(theme)
End Sub
This is my showFeed.brs:
if e <> invalid then
item.StreamBitrates.Push(strtoi(validstr(e.streamBitrate.GetText())))
item.StreamQualities.Push(validstr(e.streamQuality.GetText()))
item.StreamUrls.Push(validstr(e.streamUrl.GetText()))
endif
next idx
showCount = showCount + 1
feed.Push(item)
skipitem:
next
End Function
