Save image, sound, clip (video), canvas in TinyDB. Extension Base 64. Download file from the web and convert it to string

store the file in the ASD - application specific directory
Taifun

2 Likes

You could also use Taifun's Zip extension to password protect a file inside a zip file, then even Android 10 + aware File Managers (like Explorer) would be unable to read it.

2 Likes

Why does the following error appear when we use the Legacy filescope?

"Unable to get a response with the specific URL: ..."

Load here a small app and an image with the relevant blocks.

1 Like

Excuse me. I mean with this method :

No google apps script required if file set to anyone with the link

image

Why are you using Legacy mode ?

1 Like

Because ImagePicker can be used in Legacy mode since SDK upgraded to Android 11.
(The Write External Storage permission cannot be granted on Android 11.)

1 Like

OK thanks.

1 Like

Hello Sir Juan
Do you have simple code sir: upload image using image picker then convert to string (text) using base64
Thank you.

This has been answered here

Please do not duplicate post, you only need to ask once....

2 Likes

Hello there,

I tried the "Video (clip) to TinyDB by Base 64" but it seems that it tries to set the ASD to SD-Card. I´m knew to the APP-Inventor, so maybe there is a simple solution. Any suggestions?

Thank you
Christoph

This is the virtual sdcard created by android on your device, in your device storage. Nothing to do with an external, removable sdcard.

Thx.
Well, I also deletet the "file://" for the right path, but it still doesn´t find the file

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

To be honest I just tried getting the basic code running before integrating it into my app. So I opened a new project with the code.
I didn´t change anything instead of the "file://".
I do find the the recorded video(s) in /storage/emulated/0/DCIM/100ANDRO/Name of Video.mp4
But I can´t play any video after recording.

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

You might want to replace your local variables temporarily by global variables to be able to use Do it until you found the bug...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

2 Likes

Thanks so far! I managed to find two files for each video, that was recorded:

/storage/emulated/0/DCIM/100ANDRO/Name of Video.mp4
Size: depending of lenght

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Name of Video.mp4
Size: always 9Byte and I can´t open it manually

Theses errors occure:

Companion Screen:

The file seems to be in ASD.

Error: The player can´t load the file in /storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Name of Video.mp4

I´m not sure if this 9 Byte file is the right reference to open the Video, and I don´t get why it is created.

as already said

the message "the variable is not bound in the current context" does not help very much in debugging...

the video player might expect a full path, which starts with file:///storage/emuated/0/Android/data... or a relative path, which is /Android/data/...

Taifun

hi there!
i am currently working on my project i.e based on emotion detector in which i need to send my audio file from mit app inventor to my machine learning model via mqtt and my mentor suggested me that use base64 for this it makes easy for me, my doubt is we are converting the audio file into string, right? it is encoding i want to send the string to my machine learning model as audio file, can you please help me with this. By the way, it's a great work i observe keenly.

I have not tried to send files by MQTT, the usual thing is to send small information.
Do you need to use MQTT? Can you use FireBase or CloudDB? What is your "machine learning model"? What is your MQTT Broker?

https://community.appinventor.mit.edu/t/esp32-mqtt-broker-publish-subscribe-thingspeak/10490

https://community.appinventor.mit.edu/search?q=mqtt