Uploading Images, Videos, and Files
If your miniapp involves allowing users to upload files, Seam provides a Firebase storage bucket for our miniapp file upload and storage. This allows you to upload any file (image, video, sounds, 3d images) and not worry about hosting your own backend. Additionally, you can use this simulated testing enviroment when you build you miniapp, without needing to upload to a real server.
Getting started: Setting up Firebase locally
To get started uploading files, you'll need to run a local server to simulate the process of uploading and downloading files. Open up a new terminal at your Miniapp Builder SDK directory and run the following command:
Then, you can see a sample file upload bucket at http://127.0.0.1:4000/storage/demo-seam-miniapp-builder/files
.
Uploading Images
To upload images in your miniapp, you can use the FileUploadComponent
provided to you by Seam, like so:
This gives you a button that when clicked allows the user to pick photos from their camera roll. Check out the ImageComposerComponent
for a full example.
Uploading Videos
To upload videos in your miniapp, you can use the same FileUploadComponent
, but specify a fileType of video, like so:
This gives you a button that when clicked allows the user to a video from their camera roll. Check out the VideoBlock
for a full example.
Uploading arbitrary files
For any other file types, you can use the Firebase uploader functions yourself. Read more in the documentation here. The strategy is 1) use the upload component to upload, and then 2) store the URL in your block.
Troubleshooting
If you get the error: Error: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using the emulators.
, you unfortunately need to download a new version of the JDK (Java Development Kit). Go to the Oracle JDK Download page, download the installer, and try starting the emulators again.
Last updated