[英]Trying to use back camera followed by front camera c# mediacapture windows phone 8.1
[英]Showing video from front and back camera at the same time in Windows Phone
在我的應用中,我想以拆分視圖顯示來自前后攝像頭的視頻:
<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>
在我的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);
}
}
問題是,兩個fronBrush.SetSource(frontCam);
和backBrush.SetSource(backCam);
被打來,但我只能從頂部的后置攝像頭看到視頻。 當我更改這些命令的順序時,我會看到其他攝像機的視頻。 我嘗試了HTC 8X和模擬器。
是某種約束還是錯誤,或者我做錯了什么?
是的-我遇到了同樣的問題。 想要做完全一樣的事情。 據我所知,不可能同時運行兩個相機實例。 讓我知道您是否聽到任何不同的聲音!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.