Truvideo Video SDK

This plugin integrates TruvideoVideoSdk for handling video files, including browsing, editing, encoding, and merging videos.

Supported Platforms

  • Android
  • iOS

Features

  • Loads and displays videos from a directory
  • Edits, merges, and encodes videos
  • Generates thumbnails
  • Compares and concatenates videos
  • Retrieves video information
  • Clears noise from videos

Requirements

  • TruvideoVideoSdk Plugin

Setup

  1. Add TruvideoVideoSdk Plugin to your project.
  2. Install dependencies:
    flutter pub get
    
  3. Ensure proper permissions in AndroidManifest.xml & Info.plist.
  4. Run the app:
    flutter run
    

Usage

  • Edit a video:
    void editVideo(String videoPath) {
      TruvideoVideoSdk.editVideo(
        inputPath: videoPath,
        outputPath: "\${directoryPath}/edited_video.mp4",
        onResult: (String? result) {
          print("Video edited successfully: \$result");
        },
        onError: (String? message) {
          print("Video editing failed: \$message");
        },
      );
    }
    
  • Generate a thumbnail:
    void generateThumbnail(String videoPath) {
      TruvideoVideoSdk.generateThumbnail(
        videoUri: videoPath,
        outputPath: "",
        position: 1000,
        width: 300,
        height: 300,
        precise: true,
        onResult: (String? result) {
          print("Thumbnail generated successfully: \$result");
        },
        onError: (String? message) {
          print("Thumbnail generation failed: \$message");
        },
      );
    }
    
  • Retrieve video information:
    void getVideoInfo(String videoPath) {
    TruvideoVideoSdk.getVideoInfo(
      videoUri: videoPath,
      onResult: (String? result) {
        print("Video info: \$result");
      },
      onError: (String? message) {
        print("Failed to fetch video info: \$message");
      },
    );
    }
    
  • Clear noise from a video:
    void clearNoise(String videoPath) {
    TruvideoVideoSdk.cleanNoise(
      videoUri: videoPath,
      outputPath: "\${directoryPath}/noise_removed.mp4",
      onResult: (String? result) {
        print("Noise cleared successfully: \$result");
      },
      onError: (String? message) {
        print("Noise clearing failed: \$message");
      },
    );
    }
    
  • Encode a video:
    void encodeVideo(String videoPath) {
    TruvideoVideoSdk.changeEncoding(
      videoUri: videoPath,
      outputPath: "\${directoryPath}/encoded_video.mp4",
      width: 480,
      height: 640,
      frameRate: TruvideoSdkVideoFrameRate.fiftyFps,
      onResult: (String? result) {
        print("Video encoded successfully: \$result");
      },
      onError: (String? message) {
        print("Video encoding failed: \$message");
      },
    );
    }
    
  • Compare multiple videos:
    void compareVideos(List<String> videoPaths) {
    TruvideoVideoSdk.compareVideos(
      videoUris: videoPaths,
      onResult: (bool? result) {
        print("Videos comparison result: \$result");
      },
      onError: (String? message) {
        print("Video comparison failed: \$message");
      },
    );
    }
    
  • Concatenate multiple videos:
    void concatVideos(List<String> videoPaths) {
    TruvideoVideoSdk.concatVideos(
      videoUris: videoPaths,
      outputPath: "\${directoryPath}/concatenated_video.mp4",
      onResult: (String? result) {
        print("Videos concatenated successfully: \$result");
      },
      onError: (String? message) {
        print("Video concatenation failed: \$message");
      },
    );
    }
    
  • Merge multiple videos:
    void mergeVideos(List<String> videoPaths) {
    TruvideoVideoSdk.mergeVideos(
      videoUris: videoPaths,
      outputPath: "\${directoryPath}/merged_video.mp4",
      width: 480,
      height: 640,
      frameRate: TruvideoSdkVideoFrameRate.fiftyFps,
      onResult: (String? result) {
        print("Videos merged successfully: \$result");
      },
      onError: (String? message) {
        print("Video merging failed: \$message");
      },
    );
    }
    

Documentation

For more details, please refer to the official documentation: Truvideo Swift SDK Guide

License

MIT

Support

If you have any questions or suggestions regarding the SDK, please contact us at [email protected].