@@ -66,24 +66,35 @@ Open the `MainPage.xaml` of your project and replace the content with following
66
66
xmlns : d = " http://schemas.microsoft.com/expression/blend/2008"
67
67
xmlns : mc = " http://schemas.openxmlformats.org/markup-compatibility/2006"
68
68
mc : Ignorable = " d"
69
- Background = " {ThemeResource ApplicationPageBackgroundThemeBrush}" Width = " 800" Height = " 600" >
70
- < Grid >
69
+ Background = " {ThemeResource ApplicationPageBackgroundThemeBrush}" >
70
+
71
+ < Grid x : Name = " MainGrid" HorizontalAlignment = " Stretch" >
71
72
< Grid .RowDefinitions >
72
- < RowDefinition Height = " 60*" / >
73
+ < RowDefinition Height = " *" / >
74
+ < RowDefinition Height = " Auto" / >
73
75
< RowDefinition Height = " 200*" / >
74
76
< RowDefinition Height = " 60*" / >
77
+ < RowDefinition Height = " Auto" / >
75
78
< / Grid .RowDefinitions >
76
- < TextBox x : Name = " CalleeTextBox" Text = " Who would you like to call?" TextWrapping = " Wrap" VerticalAlignment = " Center" Grid .Row = " 0" Height = " 40" Margin = " 10,10,10,10" / >
77
- < Grid Grid .Row = " 1" >
79
+
80
+ < Grid Grid .Row = " 0" x : Name = " AppTitleBar" Background = " LightSeaGreen" >
81
+ < ! -- Width of the padding columns is set in LayoutMetricsChanged handler . -->
82
+ <!-- Using padding columns instead of Margin ensures that the background paints the area under the caption control buttons (for transparent buttons ). -->
83
+ <TextBlock x : Name = " QuickstartTitle" Text = " Calling Quickstart sample title bar" Style = " {StaticResource CaptionTextBlockStyle}" Padding = " 4,4,0,0" / >
84
+ < / Grid >
85
+
86
+ < TextBox Grid .Row = " 1" x : Name = " CalleeTextBox" PlaceholderText = " Who would you like to call?" TextWrapping = " Wrap" VerticalAlignment = " Center" / >
87
+
88
+ < Grid Grid .Row = " 2" Background = " LightGray" >
78
89
< Grid .RowDefinitions >
79
90
< RowDefinition / >
80
91
< / Grid .RowDefinitions >
81
92
< Grid .ColumnDefinitions >
82
93
< ColumnDefinition Width = " *" / >
83
94
< ColumnDefinition Width = " *" / >
84
95
< / Grid .ColumnDefinitions >
85
- < MediaElement x : Name = " LocalVideo" HorizontalAlignment = " Center" Stretch = " UniformToFill" Grid .Column = " 0" VerticalAlignment = " Center" / >
86
- < MediaElement x : Name = " RemoteVideo" HorizontalAlignment = " Center" Stretch = " UniformToFill" Grid .Column = " 1" VerticalAlignment = " Center" / >
96
+ < MediaPlayerElement x : Name = " LocalVideo" HorizontalAlignment = " Center" Stretch = " UniformToFill" Grid .Column = " 0" VerticalAlignment = " Center" AutoPlay = " True " / >
97
+ < MediaPlayerElement x : Name = " RemoteVideo" HorizontalAlignment = " Center" Stretch = " UniformToFill" Grid .Column = " 1" VerticalAlignment = " Center" AutoPlay = " True " / >
87
98
< / Grid >
88
99
< StackPanel Grid .Row = " 3" Orientation = " Vertical" Grid .RowSpan = " 2" >
89
100
< StackPanel Orientation = " Horizontal" Margin = " 10" >
@@ -93,9 +104,11 @@ Open the `MainPage.xaml` of your project and replace the content with following
93
104
< StackPanel Orientation = " Horizontal" >
94
105
< Button x : Name = " CallButton" Content = " Start/Join call" Click = " CallButton_Click" VerticalAlignment = " Center" Margin = " 10,0,0,0" Height = " 40" Width = " 123" / >
95
106
< Button x : Name = " HangupButton" Content = " Hang up" Click = " HangupButton_Click" VerticalAlignment = " Center" Margin = " 10,0,0,0" Height = " 40" Width = " 123" / >
107
+ < CheckBox x : Name = " MuteLocal" Content = " Mute" Margin = " 10,0,0,0" Click = " MuteLocal_Click" Width = " 74" / >
108
+ < CheckBox x : Name = " BackgroundBlur" Content = " Background blur" Width = " 142" Margin = " 10,0,0,0" Click = " BackgroundBlur_Click" / >
96
109
< / StackPanel >
97
- < / StackPanel
98
- < TextBlock x : Name = " State " Text = " Status " TextWrapping = " Wrap" VerticalAlignment = " Center" Margin = " 40,0, 0,0" Height = " 40 " Width = " 200 " / >
110
+ < / StackPanel >
111
+ < TextBox Grid . Row = " 4 " x : Name = " Stats " Text = " " TextWrapping = " Wrap" VerticalAlignment = " Center" Height = " 30 " Margin = " 0,2, 0,0" BorderThickness = " 2 " IsReadOnly = " True " Foreground = " LightSlateGray " / >
99
112
< / Grid >
100
113
< / Page >
101
114
```
@@ -669,39 +682,58 @@ We also need to preview the local video and render the remote video of the other
669
682
Open the ` MainWindow.xaml ` of your project and replace the content with following implementation.
670
683
671
684
``` C#
672
- < Window
673
- x : Class = " CallingQuickstart.MainWindow "
685
+ < Page
686
+ x : Class = " CallingQuickstart.MainPage "
674
687
xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation"
675
688
xmlns : x = " http://schemas.microsoft.com/winfx/2006/xaml"
676
689
xmlns : local = " using:CallingQuickstart"
677
690
xmlns : d = " http://schemas.microsoft.com/expression/blend/2008"
678
691
xmlns : mc = " http://schemas.openxmlformats.org/markup-compatibility/2006"
679
692
mc : Ignorable = " d" >
680
- < Grid >
693
+
694
+ < Grid x : Name = " MainGrid" >
681
695
< Grid .RowDefinitions >
682
- < RowDefinition Height = " 60*" / >
696
+ < RowDefinition Height = " 32" / >
697
+ < RowDefinition Height = " Auto" / >
683
698
< RowDefinition Height = " 200*" / >
684
699
< RowDefinition Height = " 60*" / >
700
+ < RowDefinition Height = " Auto" / >
685
701
< / Grid .RowDefinitions >
686
- < TextBox x : Name = " CalleeTextBox" Text = " Who would you like to call?" TextWrapping = " Wrap" VerticalAlignment = " Center" Height = " 40" Margin = " 10,10,10,10" / >
687
- < Grid Grid .Row = " 1" >
702
+
703
+ < Grid Grid .Row = " 0" x : Name = " AppTitleBar" Background = " LightSeaGreen" >
704
+ < ! -- Width of the padding columns is set in LayoutMetricsChanged handler . -->
705
+ <!-- Using padding columns instead of Margin ensures that the background paints the area under the caption control buttons (for transparent buttons ). -->
706
+ <TextBlock x : Name = " QuickstartTitle" Text = " Calling Quickstart sample title bar" Style = " {StaticResource CaptionTextBlockStyle}" Padding = " 4,4,0,0" / >
707
+ < / Grid >
708
+
709
+ < TextBox Grid .Row = " 1" x : Name = " CalleeTextBox" PlaceholderText = " Who would you like to call?" TextWrapping = " Wrap" VerticalAlignment = " Center" / >
710
+
711
+ < Grid Grid .Row = " 2" Background = " LightGray" >
688
712
< Grid .RowDefinitions >
689
713
< RowDefinition / >
690
714
< / Grid .RowDefinitions >
691
715
< Grid .ColumnDefinitions >
692
716
< ColumnDefinition Width = " *" / >
693
717
< ColumnDefinition Width = " *" / >
694
718
< / Grid .ColumnDefinitions >
695
- < MediaPlayerElement x : Name = " LocalVideo" HorizontalAlignment = " Center" Stretch = " UniformToFill" Grid .Column = " 0" VerticalAlignment = " Center" / >
696
- < MediaPlayerElement x : Name = " RemoteVideo" HorizontalAlignment = " Center" Stretch = " UniformToFill" Grid .Column = " 1" VerticalAlignment = " Center" / >
719
+ < MediaPlayerElement x : Name = " LocalVideo" HorizontalAlignment = " Center" Stretch = " UniformToFill" Grid .Column = " 0" VerticalAlignment = " Center" AutoPlay = " True " / >
720
+ < MediaPlayerElement x : Name = " RemoteVideo" HorizontalAlignment = " Center" Stretch = " UniformToFill" Grid .Column = " 1" VerticalAlignment = " Center" AutoPlay = " True " / >
697
721
< / Grid >
698
- < StackPanel Grid .Row = " 2" Orientation = " Horizontal" >
699
- < Button x : Name = " CallButton" Content = " Start Call" Click = " CallButton_Click" VerticalAlignment = " Center" Margin = " 10,0,0,0" Height = " 40" Width = " 200" / >
700
- < Button x : Name = " HangupButton" Content = " Hang Up" Click = " HangupButton_Click" VerticalAlignment = " Center" Margin = " 10,0,0,0" Height = " 40" Width = " 200" / >
701
- < TextBlock x : Name = " State" Text = " Status" TextWrapping = " Wrap" VerticalAlignment = " Center" Margin = " 40,0,0,0" Height = " 40" Width = " 200" / >
722
+ < StackPanel Grid .Row = " 3" Orientation = " Vertical" Grid .RowSpan = " 2" >
723
+ < StackPanel Orientation = " Horizontal" Margin = " 10" >
724
+ < TextBlock VerticalAlignment = " Center" > Cameras : < / TextBlock >
725
+ < ComboBox x : Name = " CameraList" HorizontalAlignment = " Left" Grid .Column = " 0" DisplayMemberPath = " Name" SelectionChanged = " CameraList_SelectionChanged" Margin = " 10" / >
726
+ < / StackPanel >
727
+ < StackPanel Orientation = " Horizontal" >
728
+ < Button x : Name = " CallButton" Content = " Start/Join call" Click = " CallButton_Click" VerticalAlignment = " Center" Margin = " 10,0,0,0" Height = " 40" Width = " 123" / >
729
+ < Button x : Name = " HangupButton" Content = " Hang up" Click = " HangupButton_Click" VerticalAlignment = " Center" Margin = " 10,0,0,0" Height = " 40" Width = " 123" / >
730
+ < CheckBox x : Name = " MuteLocal" Content = " Mute" Margin = " 10,0,0,0" Click = " MuteLocal_Click" Width = " 74" / >
731
+ < CheckBox x : Name = " BackgroundBlur" Content = " Background blur" Width = " 142" Margin = " 10,0,0,0" Click = " BackgroundBlur_Click" / >
732
+ < / StackPanel >
702
733
< / StackPanel >
703
- < / Grid >
704
- < / Window >
734
+ < TextBox Grid .Row = " 4" x : Name = " Stats" Text = " " TextWrapping = " Wrap" VerticalAlignment = " Center" Height = " 30" Margin = " 0,2,0,0" BorderThickness = " 2" IsReadOnly = " True" Foreground = " LightSlateGray" / >
735
+ < / Grid >
736
+ < / Page >
705
737
```
706
738
707
739
Open to `App .xaml .cs ` (right click and choose View Code ) and add this line to the top :
@@ -805,7 +837,7 @@ this.callAgent.OnIncomingCall += Agent_OnIncomingCallAsync;
805
837
806
838
### Start a call with video
807
839
808
- Add the implementation to the ` CallButton_Click ` to start a call with video. We need to enumerate the cameras with device manager instance and construct ` LocalVideoStream ` . We need to set the ` VideoOptions ` with ` LocalVideoStream ` and pass it with ` startCallOptions ` to set initial options for the call. By attaching ` LocalVideoStream ` to a ` MediaPlayerElement ` , we can see the preview of the local video.
840
+ Add the implementation to the ` CallButton_Click ` to start a video call with video. We need to enumerate the cameras with device manager instance and construct ` LocalVideoStream ` . We need to set the ` VideoOptions ` with ` LocalVideoStream ` and pass it with ` startCallOptions ` to set initial options for the call. By attaching ` LocalVideoStream ` to a ` MediaPlayerElement ` , we can see the preview of the local video.
809
841
``` C#
810
842
var startCallOptions = new StartCallOptions ();
811
843
0 commit comments