Author Topic: Android Media again  (Read 3922 times)

Offline Paul Smith

  • Mr. Polyvector
  • ***
  • Posts: 109
    • View Profile
Android Media again
« on: 2016-Dec-23 »
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 FX 8350/1050Ti

Offline Qedo

  • Mr. Polyvector
  • ***
  • Posts: 167
  • UNUS SED LEO
    • View Profile
Re: Android Media again
« Reply #1 on: 2016-Dec-24 »
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

Offline Paul Smith

  • Mr. Polyvector
  • ***
  • Posts: 109
    • View Profile
Re: Android Media again
« Reply #2 on: 2016-Dec-24 »
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 FX 8350/1050Ti

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: Android Media again
« Reply #3 on: 2016-Dec-24 »
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.

Offline Paul Smith

  • Mr. Polyvector
  • ***
  • Posts: 109
    • View Profile
Re: Android Media again
« Reply #4 on: 2016-Dec-24 »
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 FX 8350/1050Ti

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3679
    • View Profile
    • Space Fractal
Re: Android Media again
« Reply #5 on: 2016-Dec-24 »
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();

« Last Edit: 2016-Dec-24 by spacefractal »
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3679
    • View Profile
    • Space Fractal
Re: Android Media again
« Reply #6 on: 2016-Dec-24 »
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.
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline Paul Smith

  • Mr. Polyvector
  • ***
  • Posts: 109
    • View Profile
Re: Android Media again
« Reply #7 on: 2016-Dec-24 »
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 FX 8350/1050Ti

Offline Qedo

  • Mr. Polyvector
  • ***
  • Posts: 167
  • UNUS SED LEO
    • View Profile
Re: Android Media again
« Reply #8 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

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3679
    • View Profile
    • Space Fractal
Re: Android Media again
« Reply #9 on: 2016-Dec-24 »
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.
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline Paul Smith

  • Mr. Polyvector
  • ***
  • Posts: 109
    • View Profile
Re: Android Media again
« Reply #10 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 FX 8350/1050Ti

Offline Paul Smith

  • Mr. Polyvector
  • ***
  • Posts: 109
    • View Profile
Re: Android Media again
« Reply #11 on: 2016-Dec-24 »
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 FX 8350/1050Ti

Offline Paul Smith

  • Mr. Polyvector
  • ***
  • Posts: 109
    • View Profile
Re: Android Media again
« Reply #12 on: 2016-Dec-24 »
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 FX 8350/1050Ti

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3679
    • View Profile
    • Space Fractal
Re: Android Media again
« Reply #13 on: 2016-Dec-25 »
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.
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.