Commit 39d8b2e9 authored by Ghislain MARY's avatar Ghislain MARY

Add possibility to start a video preview stream and to rotate the video in the...

Add possibility to start a video preview stream and to rotate the video in the MS2Tester application.
parent 3e888278
......@@ -84,7 +84,7 @@ namespace ms2_tester.Helpers
}
}
public static async Task<OperationResult> StartVideoStream(String videoSwapChainPanelName, String previewSwapChainPanelName, String camera, String codec, String videoSize, UInt32 frameRate, UInt32 bitRate)
public static async Task<OperationResult> StartVideoStream(String videoSwapChainPanelName, String previewSwapChainPanelName, String camera, String codec, String videoSize, UInt32 frameRate, UInt32 bitRate, Boolean usePreviewStream)
{
if (RunInBackground)
{
......@@ -98,6 +98,7 @@ namespace ms2_tester.Helpers
message[StartVideoStreamArguments.VideoSize.ToString()] = videoSize;
message[StartVideoStreamArguments.FrameRate.ToString()] = frameRate;
message[StartVideoStreamArguments.BitRate.ToString()] = bitRate;
message[StartVideoStreamArguments.UsePreviewStream.ToString()] = usePreviewStream;
message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.StartVideoStream;
ValueSet response = await appServiceHelper.SendMessageAsync(message);
......@@ -110,7 +111,7 @@ namespace ms2_tester.Helpers
}
else
{
NativeTester.Instance.startVideoStream(videoSwapChainPanelName, previewSwapChainPanelName, camera, codec, videoSize, frameRate, bitRate);
NativeTester.Instance.startVideoStream(videoSwapChainPanelName, previewSwapChainPanelName, camera, codec, videoSize, frameRate, bitRate, usePreviewStream);
return OperationResult.Succeeded;
}
}
......
......@@ -69,7 +69,8 @@ namespace MS2TesterTasks
message[StartVideoStreamArguments.Codec.ToString()] as String,
message[StartVideoStreamArguments.VideoSize.ToString()] as String,
Convert.ToUInt32(message[StartVideoStreamArguments.FrameRate.ToString()]),
Convert.ToUInt32(message[StartVideoStreamArguments.BitRate.ToString()]));
Convert.ToUInt32(message[StartVideoStreamArguments.BitRate.ToString()]),
Convert.ToBoolean(message[StartVideoStreamArguments.UsePreviewStream.ToString()]));
response[BackgroundOperation.Result] = (int)OperationResult.Succeeded;
break;
case BackgroundRequest.StopVideoStream:
......
......@@ -29,7 +29,8 @@ namespace MS2TesterTasks
Codec,
VideoSize,
FrameRate,
BitRate
BitRate,
UsePreviewStream
}
public enum ChangeCameraArguments
......
......@@ -108,11 +108,11 @@ namespace MS2TesterTasks
}
}
public static void StartVideoStream(String videoSwapChainPanelName, String previewSwapChainPanelName, String camera, String codec, String videoSize, UInt32 frameRate, UInt32 bitRate)
public static void StartVideoStream(String videoSwapChainPanelName, String previewSwapChainPanelName, String camera, String codec, String videoSize, UInt32 frameRate, UInt32 bitRate, Boolean usePreviewStream)
{
lock (_lock)
{
NativeTester.Instance.startVideoStream(videoSwapChainPanelName, previewSwapChainPanelName, camera, codec, videoSize, frameRate, bitRate);
NativeTester.Instance.startVideoStream(videoSwapChainPanelName, previewSwapChainPanelName, camera, codec, videoSize, frameRate, bitRate, usePreviewStream);
}
}
......
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
"MS2TesterSDK": "2.12.1.380"
"MS2TesterSDK": "2.13.0.469"
},
"frameworks": {
"uap10.0": {}
......
......@@ -32,6 +32,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock x:Name="CameraLabel" Grid.Row="0" Grid.Column="0" Text="Camera:" VerticalAlignment="Center" Margin="8"/>
......@@ -60,9 +61,12 @@
</ComboBox>
<TextBlock x:Name="BitrateLabel" Grid.Row="4" Grid.Column="0" Text="Bitrate:" VerticalAlignment="Center" Margin="8"/>
<TextBox x:Name="BitrateTextBox" Grid.Row="4" Grid.Column="1" Margin="8" IsSpellCheckEnabled="False" IsTextPredictionEnabled="False" InputScope="Number" Text="1500"/>
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal">
<TextBlock x:Name="UsePreviewStreamLabel" Grid.Row="5" Grid.Column="0" Text="Use preview stream:" VerticalAlignment="Center" Margin="8"/>
<ToggleSwitch x:Name="UsePreviewStreamToggleSwitch" Grid.Row="5" Grid.Column="1" Margin="8" IsOn="False"/>
<StackPanel Grid.Row="6" Grid.ColumnSpan="2" Orientation="Horizontal">
<ToggleButton x:Name="VideoToggleButton" Content="Toggle video" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Checked="VideoToggleButton_Checked" Unchecked="VideoToggleButton_Checked"/>
<Button x:Name="ChangeCameraButton" Content="Change camera" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Click="ChangeCameraButton_Click" IsEnabled="{Binding ElementName=VideoToggleButton, Path=IsChecked}"/>
<Button x:Name="RotateCameraButton" Content="Rotate camera" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Click="RotateCameraButton_Click" IsEnabled="{Binding ElementName=VideoToggleButton, Path=IsChecked}"/>
</StackPanel>
</Grid>
<Grid x:Name="VideoGrid" Grid.Row="1" HorizontalAlignment="Center" Background="Black">
......
......@@ -103,7 +103,8 @@ namespace MS2Tester
UInt32.TryParse((FramerateComboBox.SelectedItem as ComboBoxItem).Content as String, out frameRate);
UInt32 bitRate = 1500;
UInt32.TryParse(BitrateTextBox.Text, out bitRate);
StartVideoStream(camera, codec, videoSize, frameRate, bitRate);
Boolean usePreviewStream = UsePreviewStreamToggleSwitch.IsOn;
StartVideoStream(camera, codec, videoSize, frameRate, bitRate, usePreviewStream);
}
else
{
......@@ -195,7 +196,7 @@ namespace MS2Tester
return result;
}
private async void StartVideoStream(String camera, String codec, String videoSize, UInt32 frameRate, UInt32 bitRate)
private async void StartVideoStream(String camera, String codec, String videoSize, UInt32 frameRate, UInt32 bitRate, Boolean usePreviewStream)
{
try
{
......@@ -209,7 +210,7 @@ namespace MS2Tester
var capabilities = VoipPhoneCallMedia.Audio | VoipPhoneCallMedia.Video;
call = vcc.RequestNewOutgoingCall("FooContext", "FooContact", "MS2Tester", capabilities);
call.NotifyCallActive();
OperationResult result = await MS2TesterHelper.StartVideoStream(VideoSwapChainPanel.Name, PreviewSwapChainPanel.Name, camera, codec, videoSize, frameRate, bitRate);
OperationResult result = await MS2TesterHelper.StartVideoStream(VideoSwapChainPanel.Name, PreviewSwapChainPanel.Name, camera, codec, videoSize, frameRate, bitRate, usePreviewStream);
if (result == OperationResult.Succeeded)
{
Debug.WriteLine("StartVideoStream: success");
......@@ -317,6 +318,14 @@ namespace MS2Tester
ChangeCamera(camera);
}
private async void RotateCameraButton_Click(object sender, RoutedEventArgs e)
{
int degrees = await GetOrientation();
degrees += 90;
degrees %= 360;
SetOrientation(degrees);
}
private async void SetVideoOrientation()
{
SimpleOrientation orientation = deviceOrientation;
......
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
"MS2TesterSDK": "2.12.1.380"
"MS2TesterSDK": "2.13.0.469"
},
"frameworks": {
"uap10.0": {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment