The Publish API allows uploading as well as publishing a video to a Channel or the main Account. To use this API, the user must be logged in, establishing User Context. User uploading and publishing video must have rights to upload and publish videos. In case the user doesn’t have appropriate rights, an error will be returned.

 

This API expects ‘input’ type ‘file’ object along with other parameters to function.


Sample Code

  

<form id="form1">
       
        <div>
            <input type="file" id="inpfile" />
            <input type="button" id="btn_upload" value="Upload" onclick="Upload()" />
            <br />
            <span id="lbl_status"></span>
        </div>

        <script type="text/javascript">
            function Upload() {
                var localfile = document.getElementById('inpfile');
                var status = document.getElementById('lbl_status');

                vidizmo.api.videos.publish({
                    title: "My Video",
                    description: "",
                    tags: [{ name: "tag1" }, {name: "tag2"}],
                    categories: [{ id: 0 }],
                    player : { id: 0 },
                    complete_at_percent : 100,
                    social_sharing_enabled: false,
                    embed_enabled: false,
                    download_enabled: false,
                    comments_enabled: false,
                    comment_moderation_required: false,
                    show_on_channel_library: false,
                    is_featured: false,
                    available_from: '01/01/2014',
                    expires_after: '12/31/2014',
                    viewingaccess: 2,
                    access_token: ‘go45%252f%252fpgC2skglDYtCjGR3pNf4SAaXAD%253d%253d',
                    file: localfile.files[0],
                    on_progress: function (progress, self) { status.innerHTML = progress + "%" },
                    on_error: function (msg, self) { status.innerHTML = msg.message; }
                },

                function (obj, self) {
                    status.innerHTML = "Uploading Complete :" + obj.video_url;
                });
            }
        </script>
    </form>
 

  


Properties

 

Property
Comments
title
 
Required
Title of video
description
Description of video
tags
Tags Array.
categories
 
 
Category Id this video, or pass 0 to set ‘General’ Category.
 
category_id =  2329; //assign 2329 category id  to video
player
 
 
Player theme to apply on published video
completion_criteria
percentage of a video after which video will be assumed to have been  completely watched; possible value
 
completion_criteria = 100; // means 100%
 
social_sharing_enabled
true/  false


 If sharing of this video on Social networking sites is allowed. Social Networking  sites supported are Facebook, LinkedIn, and Twitter;
 
 
embed_enabled
true/  false


 If a general user is allowed to take embed code from Player
 
download_enabled
true/  false


 If viewer is allowed to download video for offline viewing
 
comments_enabled
true/ false 
 
If viewer is allowed to add comment on the video
 
Note: user will not be able to comment if commenting is disabled on  channel
 
comment_moderation_required
true/ false 
 
 If comments added by viewer are supposed to be moderated
 
show_on_channel_library
true/ false 
 
If published video is to be listed on channel library
 
is_featured
true/ false 
 
 If the published video will be a featured video (to appear on channel home page).
available_from
Date when this video will start appearing in channel library
 
Date() value
 
expires_after
Date when this video will stop appearing in channel library
 
Date() value
 

 

Response


{
"MashupId":"14502",
"MashupIdHash":"zefxlXfxUpI%3d",
"URL":"http://video.lexcorpinc.com/MashupPlayBack.aspx?id=zefxlXfxUpI%3d",
"Status":"Published",
"Error":null
}

 


Properties

 

Property
Comments
video_id
Id of the video published
video_id_hash
Hash code of video id. This will be used by VIDIZMO Widget API
video_url
Playback URL of the published video. This will be the link to channel  playback page on VIDIZMO
message
 
Possible values:
 
Published    // you get this status if video was published successfully
Error           // if there’s an error occurred during the process.
UnAuthorized     // UnAuthorized status is set when user doesn’t have rights to  publish video
 
 
Error
Error message text in case an error occurred

 


To learn more how these Widgets work, click here on VIDIZMO JS API Implementation.

For a complete list of VIDIZMO APIs, click here on VIDIZMO Developer APIs.