Last updated

cpUploadAPI

The cpUploadAPI is used to upload video files that are already recorded or selected by the user. It allows you to handle video uploads directly through JavaScript.

Include the Script

Add the following <script> tag to your HTML to load the uploader:

<script type="text/javascript" src="//wwwcdn.cincopa.com/_cms/ugc/uploader.js"></script> 

Initialize the Uploader

Use the following line to create a new upload instance:

var uploader = new cpUploadAPI(file, options); 

Parameters:

  • file (required) - The video file (a File object) to upload.

  • options (optional) - An object to configure upload behavior, e.g., setting upload_url.

Optional Callbacks

You can pass these callback functions in the options object to track upload events:

  • onUploadComplete - Triggered when the upload finishes successfully.

  • onUploadProgress - Provides live progress updates during the upload.

  • onUploadError - Called if something goes wrong during the upload.

  • onUploadAbort - Triggered when the upload is manually aborted.

Methods

You can control the upload using the following methods:

  • start() - Starts the upload process.

  • pause() - Pauses the upload temporarily.

  • resume() - Resumes a paused upload.

  • stop() - Aborts and resets the upload.

Example:

uploader.start(); // Start upload
uploader.pause(); // Pause upload
uploader.resume(); // Resume upload
uploader.stop(); // Abort upload