Reputation: 449
I am using Xam.Plugin.Media to take photo and video. The code below is to record the video the problem is the camera is not opening when I click the button. I tried to uninstall and install the Nuget package and deleted the bin and obj still nothing. I also tried different phones with different api still nothing worked. I hope you can help me
try
{
var cafNo = entCafNo.Text;
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakeVideoSupported)
{
await DisplayAlert("No Camera", "No Camera Available", "Ok");
return;
}
var file = await CrossMedia.Current.TakeVideoAsync(
new Plugin.Media.Abstractions.StoreVideoOptions
{
SaveToAlbum = false,
Name = cafNo + "_VID.mp4",
CompressionQuality = 80,
Quality = VideoQuality.Low
}
);
entVideoUrl.Text = file.Path;
}
catch (Exception ex)
{
Console.Write(ex.Message);
}
Upvotes: 0
Views: 1584
Reputation: 18861
Android security architecture provision: by default, no application has permission to perform any action that adversely affects other applications, operating systems, or users. This includes reading and writing users' private data (such as contacts or emails), reading and writing files from other applications, performing network access, keeping devices awake, performing camera access,and so on.
To use these protected device capabilities, first add one or more < uses-permission > tags in the application manifest file (androidmanifest.xml).
In xamarin.forms,you can refer to the link here
Upvotes: 2