Hi,
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
Now, what my problem is, the video file cannot be loaded and throws an error about access denied. Any help would be appriciated.
Thanks
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);
try
{
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();
mediaPlayer.InitPlayer(mSettings);
mediaPlayer.Playlist.Clear();
mediaPlayer.Stop();
mediaPlayer.SeekToPosition(5);
thumbnail =
new
WriteableBitmap(mediaPlayer,
null
);
break
;
default
:
return
null
;
}
BitmapImage bmpImg =
new
BitmapImage();
using
(MemoryStream stream =
new
MemoryStream())
{
PngBitmapEncoder encoder =
new
PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(thumbnail));
encoder.Save(stream);
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.
Thanks