Media Handler Pro - Advance Features

Media Handler Pro include advance modules that can allow you to publish complete videos without any restrictions. Beside that it enables advance processing ability to perform complex video and audio operations in background while keeping your application to perform other tasks without waiting for completion of operation and keep informing your application about video encoding progress status.

Example Code

You can enable background processing through the following code.

MediaHandler _mhandler = new MediaHandler();
_mhandler.BackgroundProcessing = true; // enable background processing.
_mhandler.ProcessMedia();

Note: You need to create separate handler to keep track of how much video is being process and remained. Here is sample code.

[WebMethod]
public static string GetProgressStatus()
{
   return Math.Round(_mhandler.vinfo.ProcessingCompleted, 2).ToString();
   // if vinfo.processingcomplete==100, then you can get complete information from vinfo object and store it in database and perform other processing.
}

You can call GetProgressStatus() webmethod from your ajax javascript directly to keep track of how much video is being processed until now.

Here is sample jquery ajax code.

// Custom example logic
$(function () {
  $("#vprocess").on({
      click: function (e) {
         ProcessEncoding();
         var IntervalID = setInterval(function () {
              GetProgressValue(IntervalID);
         }, 1000);
             return false;
      }
  }, '#btn_process');
});
// function for checking progress bar status
function GetProgressValue(intervalid) {
$.ajax({
    type: "POST",
    url: "mp4.aspx/GetProgressStatus",
    data: "{}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (msg) {
        $("#pstats").text(msg.d);
        $("#pbar_int_01").attr('style', 'width: ' + msg.d + '%;');
        if (msg.d == "100") {
            $('#pbar01').removeClass("progress-danger");
            $('#pbar01').addClass("progress-success");
            if (intervalid != 0) {
                clearInterval(intervalid);
            }
            FetchInfo(); // this will return video information
        }
   }
});
}
// function for returning video information
function FetchInfo() {
   $.ajax({
       type: "POST",
       url: "mp4.aspx/GetInformation",
       data: "{}",
       contentType: "application/json; charset=utf-8",
       dataType: "json",
       success: function (msg) {
           $("#info").html(msg.d);
        }
    });
}
// please view complete example below for GetInformation web method

Complete Examples

Video Demo