Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Media Plugin and uwp

$
0
0

Hello,

I'm trying to take a picture in my Forms app (code sharing is plc). For this I try to use the media plugin by James (github.com/jamesmontemagno/MediaPlugin)

The code is copied from the readme, (see below)
- the Initialize() function is called

  • the permissions are ok (I've checked with the persmissions plugin)

But the TakePhotoAsync call immediatly returns null, camera does not appear (On UWP I haven't been able to test on other devices yet ).

Please help!

takePhoto.Clicked += async (sender, args) =>
{
    await CrossMedia.Current.Initialize();

    if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
    {
        DisplayAlert("No Camera", ":( No camera available.", "OK");
        return;
    }

    var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
    {
        Directory = "Sample",
        Name = "test.jpg"
    });

    if (file == null)
        return;
}

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>