No description or website provided.
C#
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
com.vzaar.api version bumped to 1.2.1 Jun 16, 2016
examples
release
samples
.gitignore
ChangeLog
README.md

README.md

vzaar API .NET client

Lighter and faster vzaar API client for .NET and Mono developers. Documentation provided below is valid for the library version 2.0.5214 and above.


vzaar is the go to video hosting platform for business. Affordable, customizable and secure. Leverage the power of online video and enable commerce with vzaar.


Using the library

To start, make sure you have included com.vzaar.api.dll into your Project References.

using com.vzaar.api;

Now you can create your vzaar client instance:

var api = new Vzaar("VZAAR_USERNAME", "VZAAR_TOKEN");

In order to use vzaar API, you need to have a valid user name and API token that you can get from your vzaar dashboard at http://vzaar.com/settings/third_party.

The very next thing you would want to do is to check if your account actually works and operational and you can do it by simple calling whoAmI():

Debug.WriteLine(api.whoAmI());

If it returns you your vzaar username, - we are good to go.

User Details

This API call returns the user's public details along with it's relevant metadata. It also contains vzaar Account ID that you can use in api.getAccountDetails call.

var details = api.getUserDetails(VZAAR_USERNAME);

Where VZAAR_USERNAME is the vzaar username. Result of this call will be an object of UserDetails type.

Account Details

This API call returns the details and rights for each vzaar subscription account type along with it's relevant metadata. This will show the details of the packages available here: http://vzaar.com/pricing

var details = api.getAccountDetails(VZAAR_ACCOUNT_ID);

Where VZAAR_ACCOUNT_ID is the unique account id assigned by vzaar.

Result of this call will be an object of AccountDetails type.

Video List

This API call returns a list of the user's active videos along with it's relevant metadata. 20 videos are returned by default but this is customizable.

var query = new VideoListQuery;
query.count = 10;
query.page = 1;
var list = api.getVideoList(query);

Video Details

This API call returns metadata about selected video, like its dimensions, thumbnail information, author, duration, play count and so on.

api.getVideoDetails(VZAAR_VIDEO_ID);

Where VZAAR_VIDEO_ID is unique vzaar video ID assigned to a video after its processing.

Upload Signature

In some cases you might need to not perform actual uploading from API but to use some third-party uploaders, like S3_Upload widget, or any other, so you would need to get only upload signature for it, so now you can have it as UploadSignature object, as XML string, as XmlDocument or as JSON string:

var api = new Vzaar("user", "token");

var query = new UploadSignatureQuery();
query.path = "/path/to/file/video.mp4";
query.filename = "video.mp4";
query.fileSize = 848484;
query.multipart = true;

var signature = api.getUploadSignature(query);

UploadSignatureQuery has the following parameters:

  • redirectUrl - post upload redirection URL
  • multipart - true|false, enables or disables multipart upload support
  • path - local path of the video file to be uploaded
  • url - remote path of the video file to be uploaded
  • filename - basename of file being uploaded
  • filesize - size in bytes of file being uploaded

In UploadSignatureQuery either path or url must be provided. Use path to upload from your local filesystem. Use url to upload from a remote location via http.

Both filesize and filename are mandatory in order to initiate the correct S3 multipart upload, although no exception will be raised from the API if either is missing. In the case of either of these parameters being missing, video processing will be significantly slower, especially for large files.

Uploading video

Upload video from local drive directly to Amazon S3 bucket. Use this method when you build desktop apps or when you upload videos to vzaar directly from your server.

var guid = api.uploadVideo("PATH/TO/SOME_FILE");

Keep in mind that file uploaded to a Amazon S3 storage in chunks of 128Kb, you can adjust this chunk size this way:

api.bufferSize = 262144; //256 kb

Processing video

This API call tells the vzaar system to process a newly uploaded video. This will encode it if necessary and then provide a vzaar video ID back.

var processQuery = new VideoProcessQuery
{
    guid = "vzcf7af7bc5a734c30a46ca3911e7f3458",
    title = "My video",
    description = "The story about how to upload video using the vzaar API",
    chunks = 25,
    profile = VideoProfile.ORIGINAL,
    labels = new string[]{"api","tutorials"}
};

var x = api.processVideo(processQuery);

If you want to replace an existing video with a new video (i.e. keep the same video_id), you can call Process Video with adding replaceId parameter equal to vzaar video ID of the video that needs to be replaced.

var processQuery = new VideoProcessQuery
{
    guid = "vzcf7af7bc5a734c30a46ca3911e7f3458",
    replaceId = 12345678, //vzaar Video ID of the video you want to replace
    title = "My video",
    description = "The story about how to upload video using the vzaar API",
    profile = VideoProfile.ORIGINAL,
    labels = new string[]{"api","tutorials"}
};
var x = api.processVideo(processQuery);

Editing video

This API call allows a user to edit or change details about a video in the system.

var editQuery = new VideoEditQuery
{
    title = "My new video",
    description = "The story about how to upload video using the vzaar API",
    markAsPrivate = true
};
var x = api.editVideo(editQuery);

Notice markAsPrivate property in VideoEditQuery variable, you can pass there true or false, and this property marks the video as private (if true) or public (if false).

Deleting video

This API call allows you to delete a video from your account. If deletion was successful it will return you true otherwise false.

var result = api.deleteVideo(VZAAR_VIDEO_ID);

Where VZAAR_VIDEO_ID is unique vzaar video ID assigned to a video after its processing.

License

Released under the MIT License.