HTML5 Animation to Video - API

  • Introduction

  • This document covers API detail and instruction to make a video from html5 animation. Following are basic steps:
    1. 1. Uploading of your HTML5 creative as zip or url for creating video.
    2. 2. A call to make video with parameters like height, width, duration etc.
    3. 3. Webhook information to get downloadable url once video gets created.
    4. 4. A pinging service to wait for output video and it's progess.
  • Method: Uploadzip

  • Description:

    This service is used to upload zip file of HTML5 creative. Zip file should contain one html file along with its dependent resources like ( css, javascript and images). This service returns “creativeid” in the response which is used in subsequent service call. Please Note: If you want to generate video from http url (instead of a zip file) then do not use this service and move to next service ‘UploadUrl’.

  •                                     Service url: https://html5animationtogif.com/api/uploadzip.ashx 
                                    
  • Request Body Parameters

  • Paramter Description Type
    FileData Post your zip file as multi part form data. Muitipart form data
  • Response Body Parameters

  • Paramter Description Type
    status Status of the execution. Possible values are “success” and “error”. string
    creativeid Unique Id of uploaded zip. This is a reference id. It has to be used in the subsequent service “converttovideo.ashx”. string
    message Error message (if any) string
  • Success response example

  •                                      { "status": "success",  "creativeid": "creative_550x550_10ed7e8783" }
                                    
  • Error response example

  •                                      { "status": " error ",  "message” ": "No file has been uploaded. " }
                                    
  • Method: UploadUrl

  • Description:

    This service is used to post "http url" of your HTML5 creative. Service returns “creativeid” in response which is used in subsequent service.
    Note: If you are uploading zip file of your html5 creative then please do not use this service and refer "UploadZip" service.

  •                                     Service url: https://html5animationtogif.com/api/uploadurl.ashx 
                                    
  • Request Body Parameters

  • Paramter Description Type
    url http url of your creative String
  • Response Body Parameters

  • Paramter Description Type
    status Status of the execution. Possible values are “success” and “error”. string
    creativeid Id of uploaded zip creative. This is a reference id. It has to be passed in the next service “converttovideo.ashx”. string
    message Error message (if any) string
  • Success response example

  •                                     { "status": "success",  "creativeid": "creative_550x550_10ed7e8783" }
                                    
  • Error response example

  •                                     { "status": " error ",  "message” ": "No file has been uploaded. " }
                                    
  • Method: ConvertToVideo

  • Description:

    This service converts your html5 creative into the Video. This service initiates rendering call asynchronously.

  •                                     Service url: https://html5animationtogif.com/api/converttovideo.ashx  
                                    
  • Request Body Parameters

  • Paramter Description Type
    clientid Id of the customer. It is provided at the time of registration or through email. string
    apikey A unique key to access API. It is provided at the time of registration or through email. string
    creativeid Id of uploaded creative. It is returned in response of "uploadzip" or "uploadurl" service call. string
    height Height of the creative. number
    width Width of the creative. number
    duration Duration of animation. number
    fps Frames per second. Possible values are 25, 30 and 60. Recommended value is 60 for smooth animation. number
    audio This attributes specifies to make video with audio. Pass value “Y” to make video with audio. Default value is “N”. number
    webhookurl Default value is “” (i.e webhookurl="") Webhook is notification to your application once video gets ready. Your application has to pass an http url of application. Once video gets ready,
    Following parameters will be posted to the webhook url:
    1. downloadurl
    2. mediaid
    3. creativeid
    For example, you can access in your application as follows var url = Request[“downloadurl”];
    downloadurl: A download url of the video.
    mediaid: Id of video in our system.
    creativeId: Unique id which was created based on your uploaded file/url
    fileext (extension of the file i.e mp4 or gif)
    string
    creativefitoption This option specifies, how does creative gest positioned in the browser. Possible values are “lefttop” and “center”. Default value is “lefttop” string
    bitratevalue This option specifies bitrate value for CBR (constant bit rate) encoding. Default value is 17 for bast file size and good quality. Minimum value is 12 and Maximum value is 35. number
    pixelformat Specifies pixel format. Possible values are YUV420P, YUV422P or YUV444P. Default value is YUV420P.
    Please note: Pixel format can improve quality and bit depth of the video. Pixel format YUV420P is supported by most of browser,players and devices. If you want to use Pixel format YUV422P or YUV444P, then first check the output video in target player/devices/browser.
    string
  • Response Body Parameters

  • Paramter Description Type
    status Status of the execution. Possible values are “success” and “error”. string
    mediaid id for the media. Use this value in the “checkstatus” service to know the status of processing. string
    message Error message (if any) string
  • Success response example

  •                                     { "status": "success",  "message": "",  " mediaid ": "34488" }
                                    
  • Error response example

  •                                     { "status": "error",  "message": "Invalid API key or Client Id" }
                                    
  • Method: Checkstatus

  • Description:

    This service is used to check status of conversion. It should be invoked after the “converttovideo” service. This service can be invoked periodically (or interval)
    Please Note: If you are passing 'webhook' url (in the converttovideo service) then skip this service. Video url and other information will be posted to webhook url automatically once video gets created.

  •                                     Service url:  https://html5animationtogif.com/api/checkstatus.ashx 
                                    
  • Request Body Parameters

  • Paramter Description Type
    creativeid id of the creative. String
    mediaid Id of the media. String
    fileext mp4. String
  • For example

  •                                     https://html5animationtogif.com/api/checkstatus.ashx?
    creativeid=creative_550x550_10ed7e8783&mediaid=34488&fileext=mp4
  • Response Body Parameters

  • Paramter Description Type
    status Status of the service call. Possible values are “success” and “error”. string
    jobstatus Status of the processing. string
    message Error message (if any) string
    url Download Url of MP4 video. string
  • Success response example

  •                                      
    Specifies, scrapping of content 
    { “status”: "success",  "jobstatus": "Scraping content. Please wait...",  "url": "" }
    
    Specifies, encoding of video
    
    { "status": "success",  "jobstatus": "20%",  "url": "" }
    { "status": "success",  "jobstatus": "40%",  "url": "" }
    { "status": "success",  "jobstatus": "90%",  "url": "" }
    
    Specifies, video has been created.
    { "status": "success",  "jobstatus": "done",  "url": "https://html5animationtogif.com/API/mediadownload.ashx?mediaid=34488&creativeid=creative_550x550_10ed7e8783&fileext=mp4&inline=y" }
                                    
  • Error response example

  •                                     { "status": "error",  "message": "File doesn't exist." }
                                    
  •