uploadBase64File

fun uploadBase64File(base64Data: String, token: String, fileName: String, listener: TaskCompletionListener<String, String>)

Uploads a base64-encoded file to the VideoSDK temporary file storage.

The file is uploaded to the VideoSDK server associated with the current meeting room. On success, the listener receives a URL that can be shared with other participants (e.g., via PubSub) and later retrieved using fetchBase64File. Uploaded files are temporary and tied to the meeting session.

The upload itself is asynchronous, with the listener callbacks invoked on the main thread. A call rejected on the spot — meeting not joined, or a missing argument — calls listener.onError synchronously on the calling thread.

Requires a joined meeting — the upload address is part of the server configuration the SDK fetches while joining. Called before the meeting is joined, or while it is reconnecting, nothing is uploaded and the reason arrives twice: once on onError (see Meeting for the codes) and once as the same text on listener.onError, so a caller waiting on the listener is not left hanging.

Code Example:


meeting.uploadBase64File(
    base64Data,   // base64-encoded file content
    token,        // authentication token
    "image.png",  // file name
    new TaskCompletionListener<String, String>() {
        
        public void onComplete(String fileUrl) {
            Log.d("Meeting", "File uploaded: " + fileUrl);
        }

        
        public void onError(String error) {
            Log.e("Meeting", "Upload error: " + error);
        }
    });

Parameters

base64Data

the base64-encoded file content

token

the VideoSDK authentication token (same token used for config)

fileName

the name of the file to upload (e.g., "image.png")

listener

the TaskCompletionListener to receive the uploaded file URL on success, or an error message on failure

See also