[英]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.