Retrieving a thumbnail of a StorageFile (Video) file that is located in the local application folder in WP8.1

I am trying to get a thumbnail of the StorageFile inside the application package (LocalFolder) of the application. A storage file is a multimedia file, which can be an image (jpg or png) or video (mp4 or wmv). Now when I try to get a sketch using the GetThumbnailAsync (ThumbnailMode) method of the StorageFile class, I get

System.Exception: component not found.

while the same works fine if the file is an image or video that is not inside the application package. Here is the code I'm using

    StorageFile file;
    private async void BtnGetVideo_Click(object sender, RoutedEventArgs e)
    {
        StorageFolder folder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Assets\\TestImgs");
        file = await folder.GetFileAsync("SMTest.mp4");
    }

    private async void BtnGetThumb_Click(object sender, RoutedEventArgs e)
    {
        if (file != null)
        {
            BitmapImage image = new BitmapImage();
            image.SetSource(await file.GetThumbnailAsync(ThumbnailMode.VideosView));
            ImagePreview.Source = image;
        }
    }

and here xaml for him

        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
            <Button x:Name="BtnGetVideo" Content="Get a Local Video" Click="BtnGetVideo_Click"/>
            <Button x:Name="BtnGetThumb" Content="Get Thumbnails" Click="BtnGetThumb_Click"/>
            <Image x:Name="ImagePreview" Height="200"/>
        </StackPanel>
+4
2

. .

, , .

, , , .

0

, , .

, .

using (VideoFrameReader videoFrameReader = new VideoFrameReader(newCreatedVideo))
        {
            await videoFrameReader.OpenMF();
            var image = videoFrameReader.GetFrameAsBitmap(TimeSpan.FromSeconds(0));

            videoFrameReader.Finalize();
        }
0

Source: https://habr.com/ru/post/1544281/


All Articles