Processing files before upload

2 posts, 1 answers
  1. Thomas
    Thomas avatar
    6 posts
    Member since:
    May 2013

    Posted 10 May 2013 Link to this post


    I'm using Telerik Upload for uploading multiple Videos. All is setup and working with Upload handler. Now, I need to add a feature where I must create a thumbnail of the video file before its uploaded. see below my current code for generating the thumbnail

    private byte[] CreateThumbNail(string fileExtention, FileInfo vidFile)
        //FileInfoFileInfo mFile = new FileInfo(filepath);
            WriteableBitmap thumbnail = null;
            switch (fileExtention)
                case ".wmv":
                case ".mp4":
                case ".mov":
                    SimplePlayerSettings mSettings = new SimplePlayerSettings();
                    SimplePlayer mediaPlayer = new SimplePlayer();
                    //mSettings.DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.Streaming;
                    mSettings.StreamSource = vidFile.OpenRead();
                    thumbnail = new WriteableBitmap(mediaPlayer, null);
                    return null;
            BitmapImage bmpImg = new BitmapImage();
            using (MemoryStream stream = new MemoryStream())
                PngBitmapEncoder encoder = new PngBitmapEncoder();
                return stream.ToArray();
        catch (Exception ex)
            return null;

    Now, what my problem is, the video file cannot be loaded and throws an error about access denied. Any help would be appriciated.

  2. Answer
    Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 15 May 2013 Link to this post

    Hello Eric,

    Unfortunately I wasn't able to reproduce this issue from the code you provided. And I'm not sure how and where you call the CreateThumbNail() method. Can you please elaborate a bit more on your implementation?

    Thank you in advance.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top