jamesmontemagno / MediaPlugin

Take & Pick Photos and Video Plugin for Xamarin and Windows
MIT License
712 stars 357 forks source link

Xam.Plugin.Media PickVideo exception on iOS #805

Open thedee opened 4 years ago

thedee commented 4 years ago

When doing a PickVideoAsync() after you select the video and then the compression status appears if you click outside of the popup an exception occurs.

My code is this: var file = await CrossMedia.Current.PickVideoAsync();

To reproduce: Choose a video Select "Use" in upper right corner As it is "Compressing Video..." click outside of the Choose Video popup. From here an exception occurs.

I am using: Xam.Plugin.Media >>> 4.4.5-beta (could not install 4.4.10-beta due to #756 ) iOS >>> 12.1.1

Exception details:

{System.AggregateException: One or more errors occurred. (Unable to find the specified file.) ---> System.IO.FileNotFoundException: Unable to find the specified file.
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00013] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2029 
  at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in <a6e593f3cb7d44ddb2035eb114e94ff7>:0 
  at System.Threading.Tasks.Task`1[TResult].get_Result () [0x0000f] in <a6e593f3cb7d44ddb2035eb114e94ff7>:0 
  at Plugin.Media.MediaImplementation+<>c__DisplayClass33_0.<GetMediaAsync>b__2 (System.Threading.Tasks.Task`1[TResult] t) [0x0001c] in D:\a\1\s\src\Media.Plugin\iOS\MediaImplementation.cs:334 
  at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in <a6e593f3cb7d44ddb2035eb114e94ff7>:0 
  at System.Threading.Tasks.Task.Execute () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319 
--- End of stack trace from previous location where exception was thrown ---

  at Plugin.Media.MediaImplementation.PickVideoAsync (System.Threading.CancellationToken token) [0x000fa] in D:\a\1\s\src\Media.Plugin\iOS\MediaImplementation.cs:177 
  at ServiceReports.ServiceReportsInput.PickVideo () [0x000e2] in D:\src\CC\00 - Main\Applications\RT\Mobile\Source\Dev\RPT\Pages\ServiceReportsInput.xaml.cs:1551 
---> (Inner Exception #0) System.IO.FileNotFoundException: Unable to find the specified file.<---
}
rr-rv commented 4 years ago

its fixed in 4.4.10, but might be ok already from 4.4.6 see #739

RuddyOne commented 4 years ago

I am still seeing this exception but now it does not crash and continues to work.... Very odd, I am on 4.4.6 beta.

ch4m0n1x101 commented 4 years ago

@Ruddy2007 I see it too on 5.0.1 Not on all devices though.

Did you find an answer?

I call in a using statement like this:

using (var file = await CrossMedia.Current.TakeVideoAsync(videoOptions).ConfigureAwait(false)) {

}

Wonder if that has anything to do with is

Stack Trace:

System.UnauthorizedAccessException: Access to the path '/private/var/mobile/Containers/Data/PluginKitPlugin/BD0317A2-FE5B-4737-9813-BD36C5E82411/tmp/trim.88A08CEB-B4ED-44F5-90AF-53A705AA5D67.MOV' is denied. at System.IO.FileSystem.DeleteFile (System.String fullPath) <0x1023b2890 + 0x00138> in <cbddc4225b2f45f09f3a1d43a1268bc0#5fa46aa2ae7f2743b43e927cead65311>:0 at System.IO.FileSystem.MoveFile (System.String sourceFullPath, System.String destFullPath) <0x1023b27d0 + 0x000a3> in <cbddc4225b2f45f09f3a1d43a1268bc0#5fa46aa2ae7f2743b43e927cead65311>:0 at System.IO.File.Move (System.String sourceFileName, System.String destFileName) <0x1023b15b0 + 0x0007f> in <cbddc4225b2f45f09f3a1d43a1268bc0#5fa46aa2ae7f2743b43e927cead65311>:0 at Plugin.Media.MediaPickerDelegate.GetMovieMediaFile (Foundation.NSDictionary info) <0x10413fef0 + 0x001ff> in <390f35b1db5e43b894d803204ceef8a9#5fa46aa2ae7f2743b43e927cead65311>:0 at Plugin.Media.MediaPickerDelegate.FinishedPickingMedia (UIKit.UIImagePickerController picker, Foundation.NSDictionary info) <0x10413e340 + 0x00443> in <390f35b1db5e43b894d803204ceef8a9#5fa46aa2ae7f2743b43e927cead65311>:0 at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) <0x10236ddc0 + 0x00053> in <cbddc4225b2f45f09f3a1d43a1268bc0#5fa46aa2ae7f2743b43e927cead65311>:0 at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () <0x103228de0 + 0x0002b> in <75e8f2cafde249969958834208668188#5fa46aa2ae7f2743b43e927cead65311>:0 at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) <0x1031cf7a0 + 0x0002f> in <75e8f2cafde249969958834208668188#5fa46aa2ae7f2743b43e927cead65311>:0 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) <0x1031cf710 + 0x00043> in <75e8f2cafde249969958834208668188#5fa46aa2ae7f2743b43e927cead65311>:0 at OPOC.Prism.iOS.Application.Main (System.String[] args) <0x1021f4220 + 0x00023> in <5d9769d48736418fbc4e1a65be02344a#5fa46aa2ae7f2743b43e927cead65311>:0 --- End of inner exception stack trace --- System.IO.IOException: Operation not permitted

RuddyOne commented 2 years ago

@ledragon101 Super late response as I just ran into this issue again... I never found a way around it.

Did you have any luck?

meopoc commented 9 months ago

@ledragon101 Super late response as I just ran into this issue again... I never found a way around it.

Did you have any luck?

@Ruddy2007 same again...did you manage to resolve?

RuddyOne commented 9 months ago

@meopoc Nope never resolved the issue.

meopoc commented 9 months ago

@Ruddy2007 Annoying huh....I think it's related to the videos being stored in iCloud but bashing my head trying to figure out how to remedy.