Created
January 16, 2016 15:55
-
-
Save wtuts/2a461e865f8e919d4e53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async void SaveThumbnail(StorageFile videofile, string thumbnailfilename) | |
{ | |
var thumbnail = await videofile.GetThumbnailAsync(ThumbnailMode.VideosView); | |
var saveFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(thumbnailfilename, CreationCollisionOption.GenerateUniqueName); | |
var inputBuffer = new Windows.Storage.Streams.Buffer(2048); | |
using (var destFileStream = await saveFile.OpenAsync(FileAccessMode.ReadWrite)) | |
{ | |
IBuffer buf; | |
while ((buf = (await thumbnail.ReadAsync(inputBuffer, inputBuffer.Capacity, InputStreamOptions.None))).Length > 0) | |
await destFileStream.WriteAsync(buf); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment