I have created a little app to play an ogg vorbis file.
/ Project: RelaxMusic
// Created: 21-09-01
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "RelaxMusic" )
SetWindowSize( 600,1300, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution(600, 1300 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
global relax,playing,duration,startTime,time
relax=LoadMusicogg("relax1.ogg")
playing=0
time=CreateEditBox()
SetEditBoxPosition(time,200,200)
SetEditBoxSize(time,200,50)
SetEditBoxText(time,"60")
SetEditBoxTextSize(time,45)
AddVirtualButton(1,300,350,100)
SetVirtualButtonSize(1,200,100)
SetVirtualButtonText(1,"PLAY")
AddVirtualButton(2,300,550,300)
SetVirtualButtonSize(2,200,100)
SetVirtualButtonText(2,"STOP")
function checkTime()
if playing=1
if (Timer()-startTime)>duration*60
StopMusicOGG(relax)
end
endif
endif
endfunction
function playRelax()
playing=1
duration=val(GetEditBoxText(time))
startTime=Timer()
PlayMusicOGG(relax)
endfunction
do
if GetVirtualButtonPressed(1) and playing=0
playRelax()
endif
if GetVirtualButtonPressed(2) and playing=1
StopMusicOGG(relax)
end
endif
checkTime()
Print( ScreenFPS() )
Sync()
loop
I exported as an Android apk and loaded it onto my phone. It installed OK and I said open and it ran OK. However when I try to run the app after this it seems to start then immediately quit. Screen shows but stops immediately.
Is there anything obviously wrong here? The sound file is about 45mb.
Using AppGameKit Studio 2021.06.14
Thanks