简体   繁体   English

在Windows Phone中同时显示来自前置和后置摄像头的视频

[英]Showing video from front and back camera at the same time in Windows Phone

In my app I want to show video from the front and back cameras in a split view: 在我的应用中,我想以拆分视图显示来自前后摄像头的视频:

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="1*"/>
        <RowDefinition Height="1*"/>
    </Grid.RowDefinitions>

    <Canvas>
        <Canvas.Background>
            <VideoBrush x:Name="backBrush" />
        </Canvas.Background>
    </Canvas>

    <Canvas Grid.Row="1">
        <Canvas.Background>
            <VideoBrush x:Name="frontBrush" />
        </Canvas.Background>
    </Canvas>

    <Ellipse Fill="Red" Height="80" Width="80" Grid.RowSpan="2" />

</Grid>

In my C# code I set source for both cameras: 在我的C#代码中,我设置了两个摄像机的源代码:

PhotoCamera frontCam;
PhotoCamera backCam;

protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);

        if (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing))
        {                
            frontCam = new Microsoft.Devices.PhotoCamera(CameraType.FrontFacing);
            frontBrush.SetSource(frontCam);
        }

        if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary))
        {                
            backCam = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
            backBrush.SetSource(backCam);
        }
    }

The problem is, that both fronBrush.SetSource(frontCam); 问题是,两个fronBrush.SetSource(frontCam); and backBrush.SetSource(backCam); backBrush.SetSource(backCam); get called but I only see video from the back camera in the top. 被打来,但我只能从顶部的后置摄像头看到视频。 When I change the order of these commands, I see video from the other camera. 当我更改这些命令的顺序时,我会看到其他摄像机的视频。 I tried HTC 8X and emulators. 我尝试了HTC 8X和模拟器。

Is it some kind of a constrain, or a bug, or am I doing something wrong? 是某种约束还是错误,或者我做错了什么?

Yeah - I'm having the same problem. 是的-我遇到了同样的问题。 Wanted to do the exact same thing. 想要做完全一样的事情。 Based upon my knowledge its not possible to have two camera instances running at the same time. 据我所知,不可能同时运行两个相机实例。 Let me know if you hear anything different! 让我知道您是否听到任何不同的声音!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试使用后置摄像头,然后使用前置摄像头C#MediaCapture Windows Phone 8.1 - Trying to use back camera followed by front camera c# mediacapture windows phone 8.1 旋转从前置摄像头捕获的图像-Windows Phone 8 - Captured images from front-facing camera are rotated - Windows Phone 8 如何使用C#在Windows Phone中使用前置摄像头捕获视频 - How to capture video using front camera in windows phone using c# Windows Phone 8.1:如何更改前置摄像头的旋转角度? - Windows Phone 8.1: how to change front camera rotation? 相机需要时间来完成Windows Phone中的任务 - Camera is taking time to finish the task in Windows phone 在Windows 8.1商店应用程序中找不到Front,Back Camera - Cannot find Front, Back Camera in windows 8.1 store app Windows Phone-实时显示网格中的项目 - Windows Phone - Showing items in grid in 'real time' Windows Phone 7合并从摄像机录制的视频 - Windows Phone 7 Merge Videos recorded from camera 从Windows Phone 10上的FileOpenPicker访问摄像头 - Access camera from FileOpenPicker on Windows Phone 10 有没有办法从Windows Phone 8.1应用程序启动手机摄像头应用程序 - Is there a way to launch phone camera app from Windows Phone 8.1 app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM