Родитель
f3a4251561
Коммит
299fac61a9
|
@ -264,10 +264,13 @@ namespace Xamarin.CommunityToolkit.UI.Views
|
|||
captureSession.AddOutput(videoOutput);
|
||||
|
||||
var audioDevice = AVCaptureDevice.GetDefaultDevice(AVMediaTypes.Audio);
|
||||
var audioInput = AVCaptureDeviceInput.FromDevice(audioDevice);
|
||||
if (audioDevice != null)
|
||||
{
|
||||
var audioInput = AVCaptureDeviceInput.FromDevice(audioDevice);
|
||||
|
||||
if (captureSession.CanAddInput(audioInput))
|
||||
captureSession.AddInput(audioInput);
|
||||
if (audioInput != null && captureSession.CanAddInput(audioInput))
|
||||
captureSession.AddInput(audioInput);
|
||||
}
|
||||
|
||||
captureSession.CommitConfiguration();
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace Xamarin.CommunityToolkit.UI.Views
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Element.Source is XCT.FileMediaSource fileSource)
|
||||
if (Element.Source is XCT.FileMediaSource fileSource && fileSource.File != null)
|
||||
asset = AVAsset.FromUrl(NSUrl.FromFilename(fileSource.File));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using CoreGraphics;
|
||||
using Intents;
|
||||
using UIKit;
|
||||
using Xamarin.CommunityToolkit.Helpers;
|
||||
using Xamarin.CommunityToolkit.PlatformConfiguration.iOSSpecific;
|
||||
|
@ -180,6 +181,9 @@ namespace Xamarin.CommunityToolkit.UI.Views
|
|||
|
||||
void SetLayout()
|
||||
{
|
||||
if (PresentationController == null || PopoverPresentationController == null)
|
||||
return;
|
||||
|
||||
((UIPopoverPresentationController)PresentationController).SourceRect = new CGRect(0, 0, PreferredContentSize.Width, PreferredContentSize.Height);
|
||||
|
||||
_ = Element ?? throw new InvalidOperationException($"{nameof(Element)} cannot be null");
|
||||
|
@ -199,6 +203,7 @@ namespace Xamarin.CommunityToolkit.UI.Views
|
|||
_ => 0f
|
||||
};
|
||||
|
||||
|
||||
PopoverPresentationController.SourceRect = new CGRect(originX, originY, 0, 0);
|
||||
PopoverPresentationController.PermittedArrowDirections = 0;
|
||||
}
|
||||
|
@ -241,6 +246,10 @@ namespace Xamarin.CommunityToolkit.UI.Views
|
|||
|
||||
void SetPresentationController()
|
||||
{
|
||||
|
||||
if (PresentationController == null)
|
||||
return;
|
||||
|
||||
var popOverDelegate = new PopoverDelegate();
|
||||
popOverDelegate.PopoverDismissed += HandlePopoverDelegateDismissed;
|
||||
|
||||
|
@ -284,8 +293,7 @@ namespace Xamarin.CommunityToolkit.UI.Views
|
|||
Element.PropertyChanged -= OnElementPropertyChanged;
|
||||
Element = null;
|
||||
|
||||
var presentationController = (UIPopoverPresentationController)PresentationController;
|
||||
if (presentationController != null)
|
||||
if (PresentationController is UIPopoverPresentationController presentationController)
|
||||
presentationController.Delegate = null;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче