Upload Media

This documentation provides guidelines on uploading images and video to server using the TruVideo Media SDK. The SDK offers simple methods to integrate upload functionalities into your application.

Prerequisites

  • Ensure you have integrated the TruVideo Core SDK into your project and completed with the authentication process

  • Camera module will provide MediaItem or simply provide filepath to upload (optional)

Step 1 : Create a MediaBuilder object

const mediaBuilder = new MediaBuilder(item.filePath);

Step 2 : Set tags or metaData mediaBuilder object if required

// Set Tags
mediaBuilder.setTag("key", "value");
mediaBuilder.setTag("color", "red");
mediaBuilder.setTag("orderNumber", "123");

// Set Metadata
mediaBuilder.setMetaData("key", "value");
mediaBuilder.setMetaData("key1", "1");
mediaBuilder.setMetaData("key2", "[4,5,6]");

Step 3 : Build the request with mediaBuilder

var request = await mediaBuilder.build();

Step 4 : Create object for getting callbacks from the SDK

Step 5 : Finally call the upload to push data to server

Result Returned

Finalize :

After completing this steps the function should look like

Last updated

Was this helpful?