Windows Phone 8.1中的MediaElement提供不受支持的视频类型错误

时间:2015-09-16 11:48:58

标签: windows-phone-8.1 mediaelement

我在Windows Phone 8.1中有一个Video Splitter应用程序,我刚给它一个更新,支持自定义修剪选项。
我测试得很好并发布到商店但是应用程序现在无法打开视频文件 这是我在手机上看到的错误的屏幕截图。

enter image description here

以下是用于打开视频文件的代码。

private void AttachFile_Click(object sender, RoutedEventArgs e)
        {
            Windows.Storage.Pickers.FileOpenPicker picker = new Windows.Storage.Pickers.FileOpenPicker();
            picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.VideosLibrary;
            picker.FileTypeFilter.Add(".wmv");
            picker.FileTypeFilter.Add(".mp4");
            FlipControl(false, Attach);
            picker.PickSingleFileAndContinue();
        }


        public void ContinueFileOpenPicker(FileOpenPickerContinuationEventArgs args)
        {
            if (args.Files.Count > 0)
            {
                _filename = args.Files[0].Path;
                videoElement.Source = new Uri(_filename, UriKind.Absolute);
            }
            else
            {
                ClearData();
            }
        }

这是将MediaElement声明为videoElement的xaml代码。

<Grid Grid.Row="1" x:Name="videoElementGrid" Grid.Column="1" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="70" />
                    <RowDefinition Height="70" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <MediaElement Grid.Row="0" Grid.Column="0" x:Name="videoElement" AutoPlay="False" AreTransportControlsEnabled="True" />
                <StackPanel Orientation="Horizontal" Grid.Row="1" Visibility="Collapsed"  x:Name="StartPanel" >
                    <Button Content="Start" Width="50" HorizontalAlignment="Left" Click="startButton_Click" />
                    <TextBlock x:Name="startText" Margin="50,0,0,0" Width="Auto"  FontSize="{StaticResource TextStyleExtraLargeFontSize}" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                </StackPanel>
                <StackPanel Grid.Row="2" Orientation="Horizontal" x:Name="EndPanel" Visibility="Collapsed">
                    <Button Content="End" HorizontalAlignment="Left" Click="endButton_Click" />
                    <TextBlock x:Name="endText" Margin="50,0,0,0" Width="Auto"  FontSize="{StaticResource TextStyleExtraLargeFontSize}" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                </StackPanel>
 </Grid>    

我甚至在标题中打印文件路径使它看起来很糟糕。这只是为了理解文件是否正确打开 任何了解这个问题的指示都非常感谢。

0 个答案:

没有答案