in Tools/Cam360/MainPage.xaml.cs [272:310]
private async void RecordButton_Tapped(object sender, TappedRoutedEventArgs e)
{
if (_isRecording)
{
RecordSymbol.Symbol = Symbol.Target;
await StopVideoRecordingAsync();
await _mediaCapture.ClearEffectsAsync(MediaStreamType.VideoRecord);
if (_sphericalProjectionEffect != null)
{
if (_sphericalProjectionEffect.SphericalProjection.IsEnabled)
{
_mediaPlayerProjection.IsEnabled = (_mediaPlayerProjection.FrameFormat == SphericalVideoFrameFormat.Equirectangular) || (ToggleForceSpherical.IsChecked == true);
_mediaPlayerProjection.FrameFormat = _sphericalProjectionEffect.SphericalProjection.FrameFormat;
_mediaPlayerProjection.HorizontalFieldOfViewInDegrees = _sphericalProjectionEffect.SphericalProjection.HorizontalFieldOfViewInDegrees;
_mediaPlayerProjection.ProjectionMode = _sphericalProjectionEffect.SphericalProjection.ProjectionMode;
_mediaPlayerProjection.ViewOrientation = _sphericalProjectionEffect.SphericalProjection.ViewOrientation;
}
_sphericalProjectionEffect = null;
}
}
else
{
RecordSymbol.Symbol = Symbol.Stop;
if (ToggleRecordProjection.IsChecked == true)
{
_sphericalProjectionEffect = new Windows.Media.Effects.VideoTransformEffectDefinition();
_sphericalProjectionEffect.SphericalProjection.IsEnabled = _mediaPlayerProjection.IsEnabled;
_sphericalProjectionEffect.SphericalProjection.FrameFormat = _mediaPlayerProjection.FrameFormat;
_sphericalProjectionEffect.SphericalProjection.HorizontalFieldOfViewInDegrees = _mediaPlayerProjection.HorizontalFieldOfViewInDegrees;
_sphericalProjectionEffect.SphericalProjection.ProjectionMode = _mediaPlayerProjection.ProjectionMode;
_sphericalProjectionEffect.SphericalProjection.ViewOrientation = _mediaPlayerProjection.ViewOrientation;
_mediaPlayerProjection.IsEnabled = false;
await _mediaCapture.AddVideoEffectAsync(_sphericalProjectionEffect, MediaStreamType.VideoRecord);
}
await StartVideoRecordingAsync();
}
_isRecording = !_isRecording;
await EnableDisableCameraControlsOnUI(!_isRecording);
}