Android Media again

Previous topic - Next topic

Paul Smith

I've gone back to basic with this.

load a simple sprite and display it.
As expected only 2 and 3 work in windows.
none work in android
I've removed GETCURRENTDIR$()+ as spacefractal says it not needed, this worked every time in v12.

and ideas

Code (glbasic) Select
SETFONT 0,3

LOADSPRITE "back.bmp",1
DRAWSPRITE 1,100,100
PRINT "1",1,1
SHOWSCREEN
MOUSEWAIT

LOADSPRITE "Media/back.bmp",2
DRAWSPRITE 2,100,100
PRINT "2",1,1
SHOWSCREEN
MOUSEWAIT

SETCURRENTDIR("Media")
LOADSPRITE "back.bmp",3
DRAWSPRITE 3,100,100
PRINT "3",1,1
SHOWSCREEN
MOUSEWAIT

LOADSPRITE "Media/back.bmp",4
DRAWSPRITE 4,100,100
PRINT "4",1,1
SHOWSCREEN
MOUSEWAIT
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

Qedo

I also have the same problems but only with Android version 5 and 6.
Hovewer with a tablet version 4.4 and  Bluestacks 4.4.2 everything works
What can it mean?
ciao
Qedo

Paul Smith

Just copied the APK onto my old tablet. 4.4. and 2 and 3 work. So GLB v14 is bugged for Android v5+.
Probably why Android is missing from the main Website Page.
I know v12 had no problems as my app was working until I reloaded my phone.

Any one have a Link for GLBasic v12?
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

erico

My apps have full path and have been workinf fine. Would that do the trick? I havent tried latest 14 yet and neither latest android. I will do so when Im back home. I think you can reach some older glb version and latest 12 on the download page.

Paul Smith

No its missing on the new web design. Tried to google it but they all say cracked version, which is sad.Probably all Virus files anyway
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

spacefractal

#5
ahhh. Its a issue im have seen before. You might need to do a DOESFILEEXIST(FILENAME$) before calling it. This force glbasic copy the file from apk to the system before access it. But for some reason its fails on newer Android systems im should look on.

Etc loading from a function:

Code (glbasic) Select

FUNCTION LOADSOUNDZ: FILEMAME$, wav, buffer
IF DOESFILEEXIST(FILENAME$)
LOADSOUND FILENAME$, wav, buffer
RETURN 1
ELSE
RETURN 0
ENDIF
ENDFUNCTION


or something like that with other LOAD commands. Its should have done automatic, but for some reasons its might fails on some android systems. Can im get a logcat eventuelly?

Also make sure you have both read and write right in the androidmanifest.xml.

Does its still fail?

Then im believe this line fails to get the correct path for the newer devices and need to been fixed (SDLActivity.Java):
java.io.File dataDir = getFilesDir();

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

you can download Andorid and iOS here:
http://www.glbasic.com/forum/index.php?topic=9644.0

Its mostlly me that meanstream the Android and iOS ports today. Its some time ago im updated it (sorry about that), but its should still works.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Paul Smith

IF DOESFILEEXIST is working for jpg and bmp but not for playmusic or  Loadsound.

I used the stock Android from the main GLBasic,http://www.glbasic.com/platform/. Is this out of date.

I downloaded that androidExtra and unpacked it to the main root of glbasic as per installation instructions, and to the platform folder just in case.
but no change. That's if I was supposed to do that.

Anyone Know the Link to the Glbasic V12

Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

Qedo

Paul i have tried also to compile with GL12 but same result.
Playmusic and Loadsound with android 6 don't work.
Ciao

spacefractal

Alternative, you can use SoundPool API, which is used in the AndroidExtras example. Its property quite better than LOAD commands.

Try to add GETCURRENTDIR$() again after a DOESFILEEXIST (which should NOT use that).

Does that work?

You should use that one from the link.

But now im are out for xmas, so im checking out for one of the follow days. Android is sometime very PITY and annoying.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Paul Smith

Quote from: Qedo on 2016-Dec-24
Paul i have tried also to compile with GL12 but same result.
Playmusic and Loadsound with android 6 don't work.
Ciao

V12 worked on my v6 Moto G 2nd,playmusic was playing .MOD and .IT tracker music files.
WAVs also worked.I lost my App after I rooted it last week.and cant find my backup.
if I find it or install v12, I'll send you a apk to test.

I cant see that v12 link from the page
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

Paul Smith

Qedo try this it's v12 pre android extras, found it on my old laptop
bouncing sprite and MOD music.

works on my V6 android,

Paul
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

Paul Smith

Right Sorted v14 for Android v6 (Well for me any way)

This Works to Play Music

Code (glbasic) Select

IF DOESFILEEXIST("1.MOD")
PLAYMUSIC GETCURRENTDIR$()+"1.MOD", 1
ENDIF


This works for Fonts

Code (glbasic) Select
IF DOESFILEEXIST("lcd.png")
LOADFONT "lcd.png", 1
ENDIF


This works for Sound

Code (glbasic) Select
IF DOESFILEEXIST("atomicnew.wav")
LOADSOUND GETCURRENTDIR$()+"atomicnew.wav", 1,1
ENDIF


and this for Sprites

Code (glbasic) Select
IF DOESFILEEXIST("galaxysm.jpg")
LOADSPRITE "galaxysm.jpg",1
ENDIF



Maybe a function similar to the one Spacefractal shown is the way forward.
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD RYZEN 7,RTX 3060TI

spacefractal

we sill fix this in one of the coming version of glbasic. Thing like that should been done automatic. Due that im will move this to the bug section.

Even there is workaround about it.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/