Uploading Images, Videos, and Files
Last updated
Last updated
If your miniapp involves allowing users to upload files, Seam provides a 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.
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
.
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.
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.
For any other file types, you can use the Firebase uploader functions yourself. Read more in the . The strategy is 1) use the upload component to upload, and then 2) store the URL in your block.
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 , download the installer, and try starting the emulators again.