在Windows phone 8中,纵向视频录制将以90度旋转的形式出现

本文关键字:旋转 90度 phone Windows 视频 | 更新日期: 2023-09-27 18:09:55

我开发了一个应用程序,我正在做视频录制。一切都运行良好。但是当我在人像方向录制视频时,视频将以90度旋转的形式出现。

我使用这个xaml视频

<Rectangle
        x:Name="viewfinderRectangle"
        Width="460"
        Height="661"
        HorizontalAlignment="Left"
        Canvas.Left="10" Canvas.Top="10"/>
        <MediaElement
        x:Name="VideoPlayer"                  
        Width="460"
        Height="661"
        AutoPlay="True"
        RenderTransformOrigin="0.5,0.5"
        VerticalAlignment="Center"
        HorizontalAlignment="Center"
        Stretch="Uniform"
        Canvas.Left="10" Canvas.Top="10">
                <MediaElement.Projection>
                    <PlaneProjection/>
                </MediaElement.Projection>
            </MediaElement>

在Windows phone 8中,纵向视频录制将以90度旋转的形式出现

在开始录制之前,您应该使用以下属性。

private AudioVideoCaptureDevice VideoRecordingDevice;
VideoRecordingDevice.SetProperty(KnownCameraGeneralProperties.EncodeWithOrientation,    VideoRecordingDevice.SensorLocation == CameraSensorLocation.Back ? 90 : -90);

注:请记住,它只用于wp8或更高版本。