victordiaz / PHONK

PHONK is a coding playground for new and old Android devices
https://phonk.app
GNU General Public License v3.0
461 stars 25 forks source link

media.useCamera('back') crashes on tablet when no back-camera available #57

Closed SuperUserNameMan closed 4 years ago

SuperUserNameMan commented 4 years ago

Hello again,

I'm testing the new Phonk 1.2.7 on my Acer B7-A71 tablet (Android 4.1.2).

Problem description PHONK 1.2.x crashes when running example media/camera.

media.useCamera('back') crashes PHONK because there is no back-camera.

media.useCamera('front') works.

Device model Acer B7-A71 tablet

CPU : MT6517 armv7l GPU : PowerVR SGX 531 RAM : 512 MB Display : 600x1024 @ 169 dpi

Android version Android 4.1.2 API Level 16 OpenGL ES 2.0

victordiaz commented 4 years ago

Hello @SuperUserNameMan

1) Did it work before? 2) Did you update the examples 3) Do you get any error?

Thanks

SuperUserNameMan commented 4 years ago

No it never worked on this tablet. I thought I told you already, but I might have forgot.

SuperUserNameMan commented 4 years ago

Oh wait ! useCamera('front') instead of back works this time.

It did not work at all with previous version.

So it only crash when useCamera('back').

And it displays no error. PHONK just close.

victordiaz commented 4 years ago

Thanks @SuperUserNameMan I will add a camara availabilty check before you can use it :)

SuperUserNameMan commented 4 years ago

@victordiaz : I've tested this example again with the new 1.2.8. It does not crash, but it does not work anymore. It displays this error : ~~[ :-( problem! ] Wrapped java.lang.NullPointerException (Camera#12) ~~

edit : nevermind, forgot to save the script after i replaced "back" with "front" into the code (since this tablet does not have back camera)

victordiaz commented 4 years ago

@SuperUserNameMan What is your expected behavior? I will have a deeper look these days

SuperUserNameMan commented 4 years ago

@SuperUserNameMan What is your expected behavior? I will have a deeper look these days

Oh sorry, nevermind ... my bad. I tested again and it works. I must have forgot to save the script before running it again into the webeditor after i replaced "back" with "front" (as my tablet does not have back camera).

Though, what do you think of this behavior for media.useCamera() :