Version - 1.0.3-beta.2

Upload Media

The uploadFile function facilitates the uploading of photos or videos by accepting the context and the URI of the local file path as parameters.

Our transcriptions module simplifies video transcription. Upload videos effortlessly, initiate transcription, and retrieve results seamlessly, it's ideal for content management, media monitoring, and educational platforms.

Example Usage :

Future<void> performUploadFlow(String filePath) async {
  try {
    // Create a new MediaBuilder with a test file path
    final builder = MediaBuilder(filePath)
      ..setTag("color", "blue")
      ..setTag("source", "flutter-sdk")
      ..setMetaData("uploadedBy", "truvideo");
 
    // Build the media upload request
    await builder.build();
 
    final mediaId = builder.getMediaId();
    print("Upload media ID is: $mediaId");
 
    // Start the upload with event callbacks
    await builder.upload(
      onProgress: (e) => print("Upload Progess: ${e['progress']}%"),
      onComplete: (e) => print("Upload Complete: ${e['remoteURL']}"),
      onError: (e) => print("Upload Failed: ${e['error']}"),
    );
  } catch (e) {
    debugPrint('Upload flow failed: $e');
  }
}

Note

Both functions are designed to upload a media file using the TruvideoSdkMedia SDK. The first function (uploadFile(videoPath:)) uses a simpler metadata and tag initialization method. The second function (uploadFile(at:)) is more flexible, using a URL parameter and allows for more complex nested metadata.

These functions can be adapted and extended based on specific requirements, such as adding more tags, customizing metadata, or modifying the progress and completion handling logic.

Get All Requests

Use getAllFileUploadRequests function to fetch all the file upload request. The function will return List<MediaBuilder>?.

Get Requests byID

Use getFileUploadRequestById function to fetch request associated with the id. The function will return MediaBuilder? object.

Upload

Call .upload function from MediaBuilder object to upload the file.

Pause

Call .pause function from MediaBuilder object to pause the uploading process.

Resume

Call .resume function from MediaBuilder object resume uploading.

Delete

Call .delete function from MediaBuilder object to delete the request.

Last updated

Was this helpful?