PlUpload Handler for ASP.NET Core Application

  • 05 December 2018

PlUpload is a popular multi-runtime file uploader that can allow you to upload any type of files via web & mobile devices

This article provide detail how you can process uloaded files directly or via chunk upload within asp.net core application and send response after completing uploads

Sample code to initialize PlUpload within your project through jQuery.

     $("#uploader").pluploadQueue({
        // General settings
        runtimes : 'html5,flash,silverlight,html4',
        url : '/api/uploader/uploads',
        chunk_size : '1mb',
        unique_names : true,
 
        // Resize images on client-side if we can
        resize : {width : 320, height : 240, quality : 90}
    });

To process and save files locally, you have to write api call to receive chunk data and save it on server.

Complete code for processing chunk data within asp.net core application below.

Example Code

This code has been tested in ASP.NET Core 2.1

Create api controller e.g uploaderController and put below actions into it.

      [HttpPost("uploads")]
       public async Task uploads()
        {
            if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
            {
                return BadRequest($"Expected a multipart request, but got {Request.ContentType}");
            }
            
            // fetch username from header if you want to receive username and create directory for user
            StringValues UserName;
            SiteConfig.HttpContextAccessor.HttpContext.Request.Headers.TryGetValue("UName", out UserName);

            // Used to accumulate all the form url encoded key value pairs in the 
            // request.
            var formAccumulator = new KeyValueAccumulator();
            // string targetFilePath = null;

            var boundary = MultipartRequestHelper.GetBoundary(
                  MediaTypeHeaderValue.Parse(Request.ContentType),
                  _defaultFormOptions.MultipartBoundaryLengthLimit);

            var reader = new MultipartReader(boundary, HttpContext.Request.Body);

            var section = await reader.ReadNextSectionAsync();

            var uploadPath = SiteConfig.Environment.ContentRootPath + "/wwwroot/uploads";
            if (!Directory.Exists(uploadPath))
            {
                Directory_Process.CreateRequiredDirectories(uploadPath);
            }

            var fileName = "";
            while (section != null)
            {
                ContentDispositionHeaderValue contentDisposition;
                var hasContentDispositionHeader = ContentDispositionHeaderValue.TryParse(section.ContentDisposition,
                    out contentDisposition);

                if (hasContentDispositionHeader)
                {
                    if (MultipartRequestHelper.HasFileContentDisposition(contentDisposition))
                    {
                        var output = formAccumulator.GetResults();
                        var chunk = "0";
                        foreach (var item in output)
                        {
                            if (item.Key == "name")
                                fileName = item.Value;
                            else if (item.Key == "chunk")
                                chunk = item.Value;
                        }

                        var Path = uploadPath + "" + fileName;
                        using (var fs = new FileStream(Path, chunk == "0" ? FileMode.Create : FileMode.Append))
                        {
                            await section.Body.CopyToAsync(fs);
                            fs.Flush();
                        }
                    }
                    else if (MultipartRequestHelper.HasFormDataContentDisposition(contentDisposition))
                    {
                        var key = HeaderUtilities.RemoveQuotes(contentDisposition.Name);
                        var encoding = GetEncoding(section);
                        using (var streamReader = new StreamReader(
                            section.Body,
                            encoding,
                            detectEncodingFromByteOrderMarks: true,
                            bufferSize: 1024,
                            leaveOpen: true))
                        {
                            // The value length limit is enforced by MultipartBodyLengthLimit
                            var value = await streamReader.ReadToEndAsync();
                            if (String.Equals(value, "undefined", StringComparison.OrdinalIgnoreCase))
                            {
                                value = String.Empty;
                            }
                            formAccumulator.Append(key.ToString(), value);

                            if (formAccumulator.ValueCount > _defaultFormOptions.ValueCountLimit)
                            {
                                throw new InvalidDataException($"Form key count limit {_defaultFormOptions.ValueCountLimit} exceeded.");
                            }
                        }
                    }
                }

                var result = formAccumulator.GetResults();

                // Drains any remaining section body that has not been consumed and
                // reads the headers for the next section.
                section = await reader.ReadNextSectionAsync();
            }

            string orignalfilename = uploadPath + "" + fileName;
           
            string url = "/" + fileName; // url of upload file
            string fileType = System.IO.Path.GetExtension(fileName);
            string fileIndex = fileName.Replace(fileType, "");

            return Ok(new { jsonrpc = "2.0", result = "OK", fname = fileName, url = url, filetype = fileType, filename = fileName, fileIndex = fileIndex });
        }

private static Encoding GetEncoding(MultipartSection section)
{
    MediaTypeHeaderValue mediaType;
    var hasMediaTypeHeader = MediaTypeHeaderValue.TryParse(section.ContentType, out mediaType);
    // UTF-7 is insecure and should not be honored. UTF-8 will succeed in 
    // most cases.
    if (!hasMediaTypeHeader || Encoding.UTF7.Equals(mediaType.Encoding))
    {
       return Encoding.UTF8;
    }
    return mediaType.Encoding;
}

This function will process chunk data and send response back to application when done.

ASP.NET Video Suite 10.1 Released

  • 07 June 2016

Today we released more stable and advance version of asp.net video suite. List of core changes include

i: More than 10 premium responsive templates plugins available
ii: Fully customizable templates
iii: More stable with hundreds of improvements
iv: Advance cloud support for media storage and streaming
v: Pure ASP.NET MVC built vi: and hundreds of more improvements.

Mobile Application Development Launched

  • 10 July 2015

We just launched extending our all products to mobile application platforms. We will use ionicframework as core platform to translate all our web solutions to clean mobile application that can be easily compilted to ios, andriod or window phone application via phonegap.

Here you can check all our converted application to mobile platform. 

For mobile application development we will rely purely on angular js for front end and php or asp.net for backened processing. We will later extend it to ruby on rail and node js platforms.

After now every web product or enterprise product have free mobile compatible app if available.

We appreciate your feedbacks for building next generation, useful mobile applications.

Gamify Application for ASP.NET and PHP Solutions.

  • 30 January 2015

We developed advance gamification application with all basic and advance features that can allow developers to integrate it within their existing php or asp.net (MVC or web form) solutions easily.

It covers almost all features required for building great gamification solution which includes

  • Badges System
  • Rewards Management System
  • Level Management
  • Points & Credits Management
  • Packages Management
  • Events Management

For more detail check live demo

ASP.NET MVC Gamify Documentation

ASP.NET Gamify Web Form Documentation

PHP Gamify Documentation

We are started selling our lighter version of kits through CodeCanyon

  • 12 August 2014

Today we extended selling our lighter version of products through CodeCanyon network on reasonal price based on standard and extended licenses.

Lighter products are those which are extract from core solution that target single core functionality or utility products.

E.g ASP.NET Video Starter Kit have more than 10 core sections including (photos, videos, audio, albums, blogs, forums, qa, groups, channels and more), every customer not need all products, some require only photo feature. 

While keeping in consideration, we made single version solution with all features for photos, videos, audio, albums, blogs, forums, qa, groups and more will be in futures.

These lighter or single core feature products to be avaialble for sale on CodeCanyon network.

List of Products:

List of products that can be available on sale through CodeCanyon are

  • ASP.NET vPhoto Kit
  • ASP.NET vAudio Kit
  • ASP.NET vQ&A Kit
  • ASP.NET vBlog Kit
  • ASP.NET vForum Kit
  • ASP.NET vGroup Kit

Upcoming Products:

List of upcoming products that can be soon available for sale including

  • ASP.NET vClassified Kit
  • ASP.NET vReal-Estate Kit
  • ASP.NET vEcommerce Kit
  • ASP.NET vDeal-Listing Kit
  • ASP.NET vAuto-Classified Kit
  • ASP.NET vDating Kit
  • and more

We appreciate your feedbacks for making more useful products and solutions that can target ASP.NET web form, MVC, Entity Framework, NHibernate and ADO.NET technologies.

All in One Bundle Features Extended.

  • 11 August 2014

Today we restructued bundle "All in One" available under puchase section of website.

Now this bundle will include complete source code (c#, vb.net) version of all products released by us including source code (c#) of ASP.NET Media Handler Pro component.

Also shipped with extended license and free upgrade of package till next five years. (Once purchased, we will get free upgrade of this package until next five years on request, upgrade will include exsiting products upgrades + newly added products in bundle)

For more information contact us with our support team.

 

Pricing of Our Products Changed.

  • 11 August 2014

Today we made adjustements in prices of our products listed under purchase section.

Detail of changes listed below.

i: Price of ASP.NET YuClone Script reduced from $199 to $149 with the release of version 8.0

ii: Price of ASP.NET Media Sharing Script reduced from $399 to $249.

iii: Price of ASP.NET Video Starter Kit Enterprise Edition reduced from $499 to $399

iv: Price of All in One bundle increased from $599 to $699 by extending features and license of this product further more.

You can check latest prices of all of our products in purchase section.

ASP.NET Video Starter Kit 8.0 Released

  • 06 August 2014

After more than one year with thousands of improvements, fixes and design modification atlast we released asp.net video starter kit version 8.0 today. This version targets same core features but refined from every aspect.

Design Improvements:

  • Introduced lighter, latest bootstrap 3.20 compatible control panel and front themes.
  • Replacement of app_themes folder with direct css usage to make it faster and use theme style sheets more efficiently.
  • Refined complete project user interface with bootstrap 3.20 compatible interface to make look and feel and html layout more cleaner.
  • More refined and responsive listings and image display.
  • and more

Video Streaming Improvements:

  • Introducing advance http script to progressively stream videos via html5 / flash player.
  • Introducing advance token & cookie based http stream protection.
  • Improved http streaming of private distribution over cloud front (RTMP and HLS)
  • Use of latest JW Player and MediaElement5 Player

Video Uploading & Publishing:

  • More improved uploader with encoding system.
  • Introducing direct video uploader which allow site administrator to upload multiple mp4 / webm etc published videos, capture thumb via HTML 5 screenshot taker, and capture duration of videos directly.
  • Improved audio uploading

Restructured Control Panel:

  • Complete redesigned control panel with enhanced management.
  • Responsive bootstrap 3.2 compatible admin control panel template.
  • More than 200 features in control panel that can control every aspect of website settings and user posted data.

Improved All Core Sections:

  • Improved almost all core sections including
  • Feature improvments of videos, audio, qa, forums, blogs and groups.
  • Improved displaying, listing and processing of data
  • Content posting structured are completely redesigned and more secured.

Data Access Layer:

  • Make data process layer more improved, scalable and secure.
  • Extended data access layer by introducing NHibernate and Entity Framework 6.0 (both nhibernate, entity framework) is in testing mode and not yet part of bundle

My Account:

  • Redesigned and improved control panel features
  • Retuned allmost all features (more than 100) avaialble in myaccount section.

User Channel:

  • Removed heavy loaded, classical style custom channels.
  • Make all feature tunned and lighter

Other Enhancement:

  • Using latest tinymice rich text box editor for posting contents through admin or user.
  • Improved way to use pretify js script to make code display in blogs, forums, qa and other part of site more beautiful
  • Improved wiki / article posting section (http://www.mediasoftpro.com/glossary/)
  • Improved website design with enhanced footer.
  • Add optional theme switcher on top.
  • Update all features using latest jquery, bootstrap and other js files.
  • Improved album listings and previews.
  • Improved photo listing and previews.
  • Introducing advance image resizer / options to resize, download photos based on various optiosn (hd, wide screen, mobile compatible and more)
  • and hundreds of more improvemends.

As ASP.NET Video Starter Kit is built from more than 20 core sections which including upto 1000 features. There may be chances of small bugs, fixes, if you found it, just report it to us via our support forum or mail.

 

Products Data Access Layer Extended

  • 02 August 2014

From first launched of ASP.NET Video Starter Kit we used ADO.NET as core data access technology for both SQL Server and MySql database management system. Now due to increasing popularity and emerging of new data access technologies we are extending support for two more data access techologies for our all web related products.

Now after version 8.0 of all our products, each product will support the following data access technologies but one at single project.

  • ADO.NET (web form project and along with mysql.data connector for mysql database support). It doesn't support MVC projects
  • NHibernate (web form and MVC version)
  • Entity Framework 6.0 (web form and MVC version)

To keep it simple, each product will support only single data access layer in one solution at a time. e.g no product have all three solutions in one project. So each bundle will be shipped with three projects based on availability or if officially released.

Restrictions:

Each project have restrictions e.g

  • Entity Framework can only be used with SQL Server Database.
  • ADO.NET can't be available in MVC version of product, means on MySQL support directly. For MySQL you can use NHibernate as database layer in MVC projects

MediaSoftPro Site Extended

  • 02 August 2014

Today we released, newly extended version of our official website http://www.mediasoftpro.com with new design and features.

List of changes done in our website

  • Replace design with latest twitter bootstrap 3.0 responsive design.
  • Implement latest own build asp.net video starter kit 8.0 features to extended, clean, fast and make more professional looks for various available features.
  • Introducing two new core sections for adding more ease to our customer for accessing various resources within our website.

Site Design Improvements:

We upgrade website design with bootstrap 3.2 compatible responsive them along with all other adjustments including

  • Link structure improvments
  • Adding social connectivity via our facebook, twitter, google plus and linkdin social accounts.
  • Improved articles, product documentation listing to be easily reachable to customers.

Integration of ASP.NET Video Starter Kit 8.0 Features:

We have upgraded all core sections including forums, blogs and Q&A with latest version of asp.net video starter kit to make our support system more improved, user friendly, fastly accessible and more user readeable.

Introducing new Core Sections:

We have introduced two new core sections in our new site.

I: Photos (Screenshots Demonstration Section)

II: Glossary (Wiki Posts or centralize our article resources in a professional way)

Introduction of these two section will help us to write more useful articles and make it reachable to users easily from centralize location rather than mixed up in various areas.

I: Photos:

Photos or screenshot section will help us to upload screenshots of various features available in our products. Some products are small and writing documentation and feature list are easy but some products like ASP.NET Video Starter Kit have more than one thousand features along with 20 core sections. Its impossible for us to write documentation for all one thousand features with detail in  a single compact area and provide a demo of every feature. Even we provide live demo for this product but it takes a complete day to browse and review all features available in a product. For us problems extended with the release of new version of product which cause us to upgrade our documentation of every feature. In such upgrade actions we mostly lose our precious search indexing.

Due to these difficulties in mind, we added newly screenshot section where we will post newly added feature screenshots along with all detail, reference codes, availability ot feature in version of selected products and more. This help us to clean our core documentation, product detail page with list of all features updated time to time and also helps customers to easily review all features along with technical and general feature detail.

II: Glossary or Wiki

This section will help us to organize all our core articles which we privously written in html format in a single unit. In past we wrote all articles in html format, which are very difficult for us to make it centralize, upgrade of article contents, upgrade these article pages with the release of new website look and feel and link structure. Small change in link structure causes severe impact on our search indexing.

These issues in mind, we introducts new glossary or wiki post section in our website. Here we will wrote all useful articles, notes, share examples and codes, technical overviews of features available in our products and more in future.

We appreciate your recommendations.

New Services Launched with CodeName JUGNOON

  • 11 January 2014

Few months back, we just launched new services via codename JUGNOON to provider next generation, lighter version of products using latest web tools including jQuery, Bootstrap, Angular JS, ASP.NET MVC and PHP.

JUGNOON Products and Services available on

http://www.jugnoon.com

JUGNOON Services will target products development in two core areas

i: ASP.NET MVC

ii: PHP

Both type of products will use latest front end tools

i: jQuery

ii: Angular JS

iii: Bootstrap.

All products and services released under JUGNOON will be available for purchase through codecanyon.net market place.

We appreciate your feedbacks for making more useful products.

MediaSoft Pro Team.

Extended Services to PHP

  • 28 August 2013

We have just started extended our services from asp.net to php. 

Until now we released all products compatible only with asp.net, c#, vb.net, .net frameworks. 

Today we released our first free php utility script PHP Media Handler Pro for processing media files.

We will soon release our all products in php version along with utility scripts.

We appreciate feedbacks. 

Media Handler Pro Free Version Extended.

  • 19 April 2013

Today we announced the release of extended version of asp.net media handler pro component free version. Now free version have almost all features and have no feature restrictions. You can freely use it in your unlimited no of applications, servers and domains.

You can download it from http://download.cnet.com/NET-Media-Handler-Pro/3000-10250_4-10875307.html

Difference Between Free Version and Full Version of Media Handler Pro.

There is only one different between pro and free version as pro version can support background video and audio processing which will prevent any deadlock in your application while encoding large media files.

For more detail about pro version visit.

http://www.mediasoftpro.com/media-handler-pro/pro.html

ASP.NET Video Starter Kit 7.0 Video Encoding Process.

  • 13 July 2012

ASP.NET Video Starter Kit 7.0 completely replaced video or audio publishing script with more reliable and advance encoding script based on newly developed video uploader and publisher engine.

New media encoding script allow you to set multi format (flv, mp4, webm, ogv), multi level (360p, 480p, 720p) youtube style video publishing mechanism by setting different settings within single encoding setting file.

Now you can easily setup your encoding routine to process source video to variety of ways including

  • convert source video to mp4 format,
  • convert source video to mp4, mp3 audio format.
  • convert source video to mp4, webm format
  • convert source video to mp4 (360p), mp4 (480p) format
  • convert source video to mp4 (360p), webm (480p) format
  • and more with your own way.

Now media settings can't be updated from control panel -> settings -> configuration -> media section, still you can set video extensions, etc from here. Now you can set different levelvideo encoding and settings via separate file. example shown below.

 public static MediaHandler ReturnMediaSettings(int itag)
{
     MediaHandler media = new MediaHandler();
     string RootPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath);
     string presetpath = RootPath + "\\ffmpeg\\presets\\libx264-baseline.ffpreset";
     switch (itag)
     {
             case 0: // 240p flv video settings
                     media.Width = 400;
                     media.Height = 240;
                     media.Video_Bitrate = 256;
                     media.Audio_SamplingRate = 22050;
                     media.Audio_Bitrate = 64;
                     media.OutputExtension = ".flv";
                     media.Force = "flv";
                     break;
             case 1: // 360p flv video settings
                     media.Width = 640;
                     media.Height = 360;
                     media.Video_Bitrate = 500;
                     media.Audio_SamplingRate = 44100;
                     media.Audio_Bitrate = 128;
                     media.OutputExtension = ".flv";
                     media.VCodec = "libx264";
                     media.Parameters = " -fpre \"" + presetpath + "\"";
                     break;
             case 2: // 480p flv video settings
                     media.Width = 854;
                     media.Height = 480;
                     media.Video_Bitrate = 1000;
                     media.Audio_SamplingRate = 44100;
                     media.Audio_Bitrate = 128;
                     media.OutputExtension = ".flv";
                     media.VCodec = "libx264";
                     media.Parameters = " -fpre \"" + presetpath + "\"";
                     break;
              case 3: // 720p flv video settings
                    media.Width = 1280;
                    media.Height = 720;
                    media.Video_Bitrate = 2000;
                    media.Audio_SamplingRate = 44100;
                    media.Audio_Bitrate = 128;
                    media.OutputExtension = ".flv";
                    media.VCodec = "libx264";
                    media.Parameters = " -fpre \"" + presetpath + "\"";
                    break;
               case 4: // 240p mp4 video encoding
                    media.Width = 400;
                    media.Height = 240;
                    media.Video_Bitrate = 256;
                    media.Audio_SamplingRate = 44100;
                    media.Audio_Bitrate = 128;
                    media.OutputExtension = ".mp4";
                    media.VCodec = "libx264";
                    media.Parameters = " -fpre \"" + presetpath + "\"";
                    break;
              case 5: // 360p mp4 video encoding
                    media.Width = 640;
                    media.Height = 380;
                    media.Video_Bitrate = 500;
                    media.Audio_SamplingRate = 44100;
                    media.Audio_Bitrate = 128;
                    media.OutputExtension = ".mp4";
                    media.VCodec = "libx264";
                    media.Parameters = " -fpre \"" + presetpath + "\"";
                    break;
              case 6: // 480p mp4 video encoding
                    media.Width = 854;
                    media.Height = 480;
                    media.Video_Bitrate = 1000;
                    media.Audio_SamplingRate = 44100;
                    media.Audio_Bitrate = 128;
                    media.OutputExtension = ".mp4";
                    media.VCodec = "libx264";
                    media.Parameters = " -fpre \"" + presetpath + "\"";
                   break;
              case 7: // 720p mp4 video encoding
                   media.Width = 1280;
                   media.Height = 720;
media.Video_Bitrate = 2200;
media.Audio_SamplingRate = 44100;
media.Audio_Bitrate = 96;
media.OutputExtension = ".mp4";
media.VCodec = "libx264";
media.Parameters = " -fpre \"" + presetpath + "\"";
break;
case 8: // 1080p mp4 video encoding
media.Width = 1920;
media.Height = 1080;
media.Video_Bitrate = 2900;
media.Audio_SamplingRate = 44100;
media.Audio_Bitrate = 152;
media.OutputExtension = ".mp4";
media.VCodec = "libx264";
media.Parameters = " -fpre \"" + presetpath + "\"";
break;
case 9: // 240p webm video encoding
media.Width = 400;
media.Height = 240;
media.Video_Bitrate = 256;
media.Audio_SamplingRate = 44100;
media.Audio_Bitrate = 128;
media.OutputExtension = ".webm";
media.VCodec = "libx264";
presetpath = RootPath + "\\ffmpeg\\presets\\libvpx-360p.ffpreset";
media.VCodec = "libvpx";
media.ACodec = "libvorbis";
media.Parameters = "-f webm -aspect 4:3 -fpre \"" + presetpath + "\"";
break;
case 10: // 360p webm video encoding
media.Width = 640;
media.Height = 380;
media.Video_Bitrate = 500;
media.Audio_SamplingRate = 44100;
media.Audio_Bitrate = 128;
media.OutputExtension = ".webm";
media.VCodec = "libx264";
presetpath = RootPath + "\\ffmpeg\\presets\\libvpx-360p.ffpreset";
media.VCodec = "libvpx";
media.ACodec = "libvorbis";
media.Parameters = "-f webm -aspect 4:3 -fpre \"" + presetpath + "\"";
break;
case 11: // 480p webm video encoding
media.Width = 854;
media.Height = 480;
media.Video_Bitrate = 1000;
media.Audio_SamplingRate = 44100;
media.Audio_Bitrate = 192;
media.OutputExtension = ".webm";
media.VCodec = "libx264";
presetpath = RootPath + "\\ffmpeg\\presets\\libvpx-360p.ffpreset";
media.VCodec = "libvpx";
media.ACodec = "libvorbis";
media.Parameters = "-f webm -aspect 4:3 -fpre \"" + presetpath + "\"";
break;
case 12: // 720p webm video encoding
media.Width = 1280;
media.Height = 720;
media.Video_Bitrate = 2200;
media.Audio_SamplingRate = 44100;
media.Audio_Bitrate = 192;
media.OutputExtension = ".webm";
media.VCodec = "libx264";
presetpath = RootPath + "\\ffmpeg\\presets\\libvpx-360p.ffpreset";
media.VCodec = "libvpx";
media.ACodec = "libvorbis";
media.Parameters = "-f webm -aspect 4:3 -fpre \"" + presetpath + "\"";
break;
case 13: // 1080p webm video encoding
media.Width = 1920;
media.Height = 1080;
media.Video_Bitrate = 2900;
media.Audio_SamplingRate = 44100;
media.Audio_Bitrate = 192;
media.OutputExtension = ".webm";
media.VCodec = "libx264";
presetpath = RootPath + "\\ffmpeg\\presets\\libvpx-360p.ffpreset";
media.VCodec = "libvpx";
media.ACodec = "libvorbis";
media.Parameters = "-f webm -aspect 4:3 -fpre \"" + presetpath + "\"";
break;
case 14: // mp3 audio encoding
media.DisableVideo = true;
media.Channel = 2;
media.Audio_SamplingRate = 4800;
media.Audio_Bitrate = 192;
media.OutputExtension = ".mp3";
break;
}
return media;
}

You can add more options and update existing options based on your encoding settings.

How to enable encoding based on your selected settings?

You can just pass setting id as string or array list to media encoder class which is responsible for publishing videos. e.g if you want to allow script to encode 360p mp4 encoding, just add the following script in video uploader file.

ArrayList itags = new ArrayList();
itags.Add("5");encoder.iTags = itags;

e.g if you want to encode 360p mp4 video and mp3 audio file for listing audio as alternative source. do the following settings.

ArrayList itags = new ArrayList();
itags.Add("5");itags.Add("14");encoder.iTags = itags;

Once updated, rest of videos will be published based on your settings.

You can enable cloud storage to store published videos and audio files to cloud (builtin amazon s3 supported), you need to setup, enable cloud storage from control panel -> settings -> configurations -> cloud setting section  inorder to perform storage properly.

encoder.EnableCloudStorage = true;

You can delete source video after publishing by using the followng setting

 encoder.DeleteSource = true;

Hope this guide will help you to implement best possible approach for encoding high quality videos and audio files  via asp.net video starter kit 7.0 applicatioin.

ASP.NET Video Starter Kit 7.0 Has Been Released!

  • 07 July 2012

We just released asp.net video starter kit after more than year of effort to make it lighter, faster and more scalable.

We have added lots of new features, addition of new core sections and added hundreds of improvements in almost every section, module or features within asp.net video starter kit solution. 

It is now fully compatible with next generation user interface development tools (Jquery + Twitter Bootstrap)

For more information, visit http://www.mediasoftpro.com/video-starter-kit/7.0/whats-new.html

Group Related Categories in Single Unit - ASP.NET Category Listing Script.

  • 06 March 2012

Asp.net category listing script allows developer to create professional category listings, separate listing for different types of content (click here for detail) and provide ability to group related categories into single units within each type of content.

There are situations where you need to group related categories into single unit even for same type of contents. e.g you need to split car photo categories into smaller unites with related behaviours like

Auto Maker (Honda, Toyota, Lexus, Porsche, BMW, Mercedes etc)

Vehicle Style (Convertible, Coupe, Sedan, SUV)

Vehicle Types (Hybrid, Diesel, Budget, Luxury, Racing, Police)

Auto Shows (Geneva, Paris, New York etc)

Enthusiast (Antique Cars, Exotic Cars etc)

Under above example all categories belong to same category types (photos) or (auto photos) but internally they have differences. This will create confusing category listing if you not split these various category listing into single units which have similarities.

So asp.net category listing script will simplify this by introducing property mode. Using mode property you can

  •  Assign unique mode to each category while adding
  • Load categories and generate listing based on selected type and mode.

How To Create Modes

Under category management, site administrator can add and assign unique id to each mode within drop down listing. Sample modes shown below.

<asp:ListItem Text="Normal" Value="0" Selected="True"></asp:ListItem>

<asp:ListItem Text="Auto Maker" Value="1"></asp:ListItem>

<asp:ListItem Text="Vehicle Style" Value="2"></asp:ListItem>

<asp:ListItem Text="Vehicle Types" Value="3"></asp:ListItem>

<asp:ListItem Text="Auto Shows" Value="2"></asp:ListItem>

How to Filter Records Based on Type and Mode

By setting two lines of code for asp.net category listing user control you can filter category listings based on type and mode. Examples are below

cat.Type = 0; // e.g represent photos
cat.Mode = 1; // represent auto maker
cat.Title = "Auto Maker";

Example 2:
cat.Type = 0; // e.g represent photos
cat.Mode = 2; // represent vehicle style
cat.Title = "Vehicle Style";

Example 3:

cat.Type = 0; // e.g represent photos
cat.Mode = 3; // represent vehicle type
cat.Title = "Vehicle Type";

Example 4:
cat.Type = 0; // e.g represent photos
cat.Mode = 4; // represent auto show
cat.Title = "Auto Shows";

Hope this article will help you understand importance of using property "Mode" and "Type" togather for filtering and grouping category listings in useful manner.

Manage Categories for Different Type of Content.

  • 06 March 2012

ASP.NET Category Listing Script support creating category listing for almost every type of needs. (simple listing, navigation links and menus, advance directory listings).

There are scenarios where you need to manage categories separately for different contents. e.g you need to create separate category listing for photos, videos, classified, forums, blogs etc.

In order to manage categories separetly for different types of contents, asp.net category listing script provide a property "Type" through which you can

  • Create new type (register it within type dropdown in category management and assign unique id e.g 0 -> videos)
  • Create directory and assign type e.g for video category (0 -> videos)
  • At time of generating script, use type=0 to load only those categories assigned with value (Type=0 -> videos)

You can create list of types and add these types in dropdowns in order to allow administrator to add categories and assign category with correct type in order to load it in correct section.

Example List of Types

e.g in asp.net video starter kit the following type list is used mainly.


  • Type -> 0 for Video Categories
  • Type -> 1 for Group Categories
  • Type -> 2 for User Channels
  • Type -> 4 for Abuse Types
  • Type -> 5 for Photos / Galleries
  • Type -> 6 for Blogs / Articles
  • Type -> 7 for Audio Files

Register Types

You can easily add types in Type Drop Down under manage categories, process categories section in control panel. Sample drop down listing as shown below.
 
<asp:ListItem Text="General" Value="3"></asp:ListItem>
<asp:ListItem Text="Videos" Value="0"></asp:ListItem>
<asp:ListItem Text="Channels" Value="2"></asp:ListItem>
<asp:ListItem Text="Abuse Types" Value="4"></asp:ListItem>
<asp:ListItem Text="Classified" Value="13"></asp:ListItem>
 

Create Category

e.g if you want to create new video category, click on "add category" link and choose type "videos" from dropdown. This will create and assign category with type "videos"
 

Loading Type Video Categories

If you want to load categories of type video. e.g video type -> 0 you need to use the following one line of code while using asp.net category listing user control.

Categories1.Type = 0;
Hope this article will help you understand managing categories for different contents.

iPhone HTTP Streaming using ASP.NET, C# and VB.NET

  • 02 February 2012

With iPhone OS 3 update came the ability to do live streaming. There are a few types of streaming and each requires a certain encoding and segmentation. In this example i am building stream using asp.net media handler pro, open source ffmpeg and segmenter utility.

Requirements

i: asp.net media handler pro

ii: open source ffmpeg utility

iii: segmenter

Steps

Publish video to iphone device

Supported Settings For Iphone

The supported bitrates for streaming are: 100 Kbps to 1.6 Mbps

The suggested bitrates for streaming are*: Low – 96 Kbps video, 64 Kbps audio

Medium – 256 Kbps video, 64 Kbps audio

High – 800 Kbps video, 64 Kbps audio

The iPhone screen size is: 480×320

Suggested ffmpeg command for encoding iphone video

ffmpeg -i <in file> -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320×240 -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 <output file>

 

Segment Video For Http Streaming

Now you have a complete video but you don't want to toss the entire thing up or you wouldn't be reading about HTTP streaming. What you need is a way to segment the video stream into smaller chunks. You can download Apple's segmenter 

Publishing Iphone .TS Video and Making Playlist Segment via ASP.NET Media Handler Pro

Below sample code will help you to publish .ts (video/MP2T) video and create .m3u8 (application/x-mpegURL) segments via segmenter tool.

MediaHandler media = new MediaHandler();

string RootPath = Server.MapPath(Request.ApplicationPath);

media.FFMPEGPath = RootPath + "\\\\ffmpeg\\\\ffmpeg.exe";

media.InputPath = RootPath + "\\\\contents\\\\hls";

media.OutputPath = RootPath + "\\\\contents\\\\hls";

media.FileName = "a.wmv";

media.OutputFileName = "a";

media.OutputExtension = ".ts";

media.Parameters = "-f mpegts -acodec libmp3lame -ar 48000 -ab 64k -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 -s 320x240";

VideoInfo info = media.Process();

if (info.ErrorCode > 0)

{

    Response.Write("Error Occured: " + info.ErrorCode);

    return;

}

media.ServicePath = RootPath + "\\\\segmenter\\\\segmenter.exe";

string ts_filename = "\\"" + media.OutputPath + "\\\\a.ts\\"";

string m3u8_filename = "\\"" + media.OutputPath + "\\\\stream.m3u8\\"";

string prefix = "\\"" + media.OutputPath + "\\\\stream\\"";

media.Parameters = ts_filename + " 10 " + prefix + " " + m3u8_filename + " http://www.example.com/";

string output = media.ProcessCMD();

Response.Write(output);

This code will generate output .ts video with .m3u8 and segment playlist.

Add Mimetype

In order to stream .ts and .m3u8 format files properly you must add the following two mimetypes

.m3u8 application/x-mpegURL

.ts video/MP2T

 

Test Streaming

The video is encoded for the iPhone, segmented for streaming, and the server is configured. The only thing left to do is test the stream and the fastest way to do that is to use the new HTML5 video tag.

<video width='150' height='150' src="stream-128k.m3u8" />

Generating Google and Yahoo Sitemaps in ASP.NET Video Starter Kit.

  • 03 November 2011

ASP.NET Video Starter Kit support both google sitemap and yahoo ror sitemap generator and yahoo ror sitemap generator for posting dynamic content listing urls to google, yahoo, bing and other search engines.

These sitemaps helps your website contents to be fastly crawled and index by google, yahoo, bing and other search engines and in result with organic visitors increase (visitors comes through search results)

List of sitemaps supported by asp.net video starter kit 6.0

  •  Category Urls (for submitting category urls to search engines)
  • Tag Urls (for submitting tag cloud urls to search engines)
  • Video & Audio Urls ( for submitting videos and audio file urls to search engines)
  • Photo Urls (for submitting photo urls to search engines)
  • Gallery Urls (for submitting gallery urls)
  • Blog Urls (for submitting blog urls)
  • Forum Urls (for submiting forum urls)
  • Forum Topic Urls (for submitting forum topic urls)

 

Both Google and Yahoo sitemaps supported for content types mentioned above.

All sitemap files located at /sitemaps/ folder.

You can register these sitemaps through webmaster tools e.g Google Webmaster Tool, Yahoo Webmaster Tool, etc

Each sitemap can generate upto 50,000 Urls (maximum restriction of search engines), if your website records exceeds 50,000 records for specific section e.g videos you can generate another sitemap for next 50,000 records by passing pagenumber.

You can submit different types of content sitemap by using "type" querystring e.g

    • category_urls.asxh?type=0 // represent video categories
    • category_urls.asxh?type=1 // represent photo categories

Free and Paid Membership in ASP.NET Video Starter Kit 6.0

  • 02 November 2011

ASP.NET Video Starter Kit version 6.0 introduced new level of membership management. Now site administrator can allocate resources, restrict account usage for free members and allow paid members to enhance their account usages and credits by purchasing paid packages.

Now site administrator can

    • Enable, Disable Resource Allocation and Membership Process
    • Create unlimited number of free and paid packages
    • Assign any free package with free user
    • Free user can upgrade their membership by purchasing any of available paid package.
    • Paypal integration of payment
    • Payment history will be generated for user under purchase history section and for site administrator.
    • User account resources will be upgraded according to package purchased.

 

Enable Package Management:

It can be enabled from control panel -> settings -> configurations -> features -> display packages

Manage Packages:

Packages can be managed through control panel -> settings -> package management section

Site administrator can add unlimited number of free and paid packages and can update package information any time.

Features Available in Each Package:

In each package site administrator can manage

 

    • Package Name
    • Package Description
    • Price
    • Credits (available credits to be used for purchasing premium contents)
    • No of uploaded videos (maximum allocation for uploading videos)
    • No of uploaded audio files (maximum allocation for uploading audio files)
    • No of photo galleries (maximum photo galleries to be allowed to create)
    • No of uploaded photos (maximum number of photos to be allowed)
    • No of blog posts (maximum number of blog posts allowed)
    • Space Video (maximum number of space allocated for videos in MB)
    • Space Audio (maximum number of space allocated for audio files in MB)
    • Space Photo (maximum number of space allocated for photo storage)
    • Package Type (free or paid package)

 

Site admin can assign any of free package to normal users. At time of registeration user account will be update with assign package information. so user will be restricted to use account with package limitation.

If membership package is disabled, free user have unlimited access to user and upload contents without any limitations.

Package Purchasing:

Free or paid user can upgrade their account usage any time by selecting any paid package from list of available packages. Once purchased, their account remained usage stats will be upgraded.

If user try to upload video and there is no sufficient balance avaialble to upload videos, then sript will automatically redirect user to purchase package section.

Payment Options:

User can purchased any package through paypal.