Mediaplugin: TakeVideoAsync crash on iOS 11 with SaveToAlbum

Created on 29 Sep 2017  路  7Comments  路  Source: jamesmontemagno/MediaPlugin

Hello,
a bug is appeared after iOS 11 upgrade.

Bug Information

"TakeVideoAsync" crash on iOS 11 if "SaveToAlbum" is true

Version Number of Plugin: 3.0.1
Device Tested On: iPhone 7 Plus

Steps to reproduce the Behavior

Call "TakeVideoAsync" with SaveToAlbum = true on iOS 11

Actual Behavior

Crash pressing "Use video" after video recording.

Code snippet

file = await CrossMedia.Current.TakeVideoAsync(new StoreVideoOptions
{
    Directory = "MyAppName",
    Name = DateTime.Now.ToString("hh-mm-dd-MM-yyyy") + ".mp4",
    DefaultCamera = CameraDevice.Rear,
    SaveToAlbum = true,
    Quality = VideoQuality.Medium
});

Thanks for your support

bug need-more-info

Most helpful comment

Will add to docs!

All 7 comments

I am not able to reproduce this issue with following permissions enabled

  • Camera
  • Mic
  • Photos library

Make sure you have these permission enabled on your app.

Please share the complete crash log, and stacktrace if you continue to have an issue

And are you compiling against iOS11?

@jamesmontemagno @prashantvc both compiling against iOS8 and iOS11

Here the full code that shows that all permissions checks are passed before the TakeVideoAsync invocation:
https://gist.github.com/MarcorOnline/5a569c922125768bbe1ed66b42252add

If I comment the line "SaveToAlbum" all works well.

Info.plist contains the right keys, obviously:

<key>NSPhotoLibraryUsageDescription</key>
<string>Choose video to upload from gallery</string>
<key>NSCameraUsageDescription</key>
<string>Register videos for challenges</string>
<key>NSMicrophoneUsageDescription</key>
<string>Register audio for challenges</string>

I'm using the nuget packages. Next week I will try importing the GitHub files (now I can't do it beacuse I'm out of office). Tell me if you have any ideas.

Thanks for your support!

So, i think they removed some APIs from iOS 11: http://sametdede.com/alassetslibrary-is-deprecated-now-what/

Will need to switch it over to PHPhotoLibrary

@jamesmontemagno @MarcorOnline
iOS 11 added a new permission that is required when you want to add media to the media library.

So adding the following to the Info.plist should fix the issue

<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app needs access to the photo gallery.</string>

@jamesmontemagno the solution provided by @JensSchadron works well!

Thanks!

Will add to docs!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mdcso picture mdcso  路  4Comments

dmitrevski picture dmitrevski  路  7Comments

ivmazurenko picture ivmazurenko  路  3Comments

fadaEntrepidus picture fadaEntrepidus  路  6Comments

erossini picture erossini  路  3Comments