Open jamesmontemagno opened 8 years ago
This is occurring on Pixel C with July 5, 2016 security patch for Marshmallow 6.0.1. If this is marked closed, is there a Beta build I can grab this from? Thanks for all your hard work James
I tested on latest beta i just pushed with Android N and no issues here.
Ok, so we just tell all our Marshmallow users they are out of luck?
EDITED by James
@swansca79 I find that highly inappropriate seeing that his is an open source project that the community is collaborating on. I help maintain this project with others in my spare time. I will be deleting your comment.
I should say that also, I have also tested this on Android L, M, and N and did not have issues on my devices locally. The source code is open source.
@jamesmontemagno I appreciate all your work as I use your libraries but I have a Pixel C and would gladly do a screen share to show you it not working. I will try it on my Samsung next but the Pixel C is a production device by Google. I am following your code example and the other functions work as expected.
@logikonline I recently updated the test project that will make it easier to debug through to see if you can catch something in there.
I cannot get the Pixel C to run the test. These are the two log files - are they of any help? Pardon my ignorance on this. The Samsung does work though.
I am re-setting my Nexus 9 currently to get it back to 6.0.1 to test, thanks for the stack traces.
@logikonline I am not sure what is going on with your build there. Maybe go into the settings and turn off "Fast deploy" for the android project.
I just booted it up on my Nexus 9 with 6.0.1 August 5, 2016 security update and it worked without any issues and I got back the video.
Maybe something was adjusted between the security updates? I could try to go back farther, but I assume the Pixel C also got this update?
@jamesmontemagno I tried a variety of builds on my Pixel C - from M 6.0.1 MXC89H to N NPD56N and they all fail. I settled with "M 6.0.1 MXC89K" and this is the error I got from running your test app:
"Unable to locate media file at content://media/external/video/media/50" It fails at the return from the capture. I am unsure how to debug further for you.
It is also strange how the capture app is formatted on the Pixel C during capture - Samsung is much nicer presentation.
Hmmmmmm the Nexus 9 has very different build numbers:
Perhaps it is just with Pixel C... I will try to install an older build to test.
In Android 5.1.1 they changed some things when using external camera and how they handle permissions.
You can see I actually added this:
if ((int)Build.VERSION.SdkInt >= 22)
proj = new[] { MediaStore.MediaColumns.Data };
in the MediaPickerActivity.
You could play around with this code and perhaps other code that is looking at SDKInts...
I'll dig into it this weekend, I only have a few days left in my sprint and I need to hit my burn down target. I believe the emulators offer the Pixel C (https://developer.android.com/preview/download.html)
Having same issue on Nexus 5X. The bug reproducible only on Google's stock camera app. Other camera app's works just fine.
@eligreenfeld can you verify what build you are running of android please
@jamesmontemagno 2.5.1-beta38
@eligreenfeld your nexus 5x though, what build of android is it? 6.0.1, but what security update and build number?
@jamesmontemagno 6.0.1 Security Patch: August 5, 2016 build number: MTC20F
@jamesmontemagno I was unable to get any further last weekend on it. It fails coming back from var tcs = Interlocked.Exchange(ref this.completionSource, null); - meaning the error reports back:
Plugin.Media.Abstractions.MediaFileNotFoundException: Unable to locate media file at content://media/external/video/media/58
which it is trying to locate the file at the path : content://media/external/video/media/58 Maybe this path is unroutable? I know the file exists because if I go back into the library with Pick a VIdeo - it finds it correctly at:
/storage/emulated/0/Android/data/MediaAndroidTest.MediaAndroidTest/files/Movies/temp/VID_20160810_153458.mp4
If I recall when I was doing a cross download manager - this looks like the unroutable file descriptor vs when I called the OpenDownloadedFile with the Id. Perhaps the 58 is the Id that has to be passed to have it moved from the sandbox value over?
I think the issue stems from this and I am not sure how to alter the code to make this function work in Xamarin. https://stackoverflow.com/questions/20028319/how-to-convert-content-media-external-images-media-y-to-file-storage-sdc
The path being returned is not a routable fileURI. If you can assist, I know it is at the OnActivityResult in the MediaPickerActivity.
@logikonline that code should be around here: https://github.com/jamesmontemagno/MediaPlugin/blob/master/src/Media.Plugin.Android/MediaPickerActivity.cs#L398-L425
I can confirm this is also occurring on my Nexus 5
I found fix for this issue on Nexus 5. Problem is in MediaPickerActivity.cs, function TryMoveFileAsync. There is ContentResolver.Delete which is behind Move. Unfortunately on Nexus 5 will contenresolver delete new file and so it is not found later.
Here is working code. I just changed order of delete (ContentResolver first, file then) and it works on Nexus 5 with 6.0.1. Tested from Android project only, now I am going to build binaries for test in Forms but I don't see difference and thus publishing immediately.
public static Task<bool> TryMoveFileAsync(Context context, Uri url, Uri path, bool isPhoto, bool saveToAlbum)
{
string moveTo = GetLocalPath(path);
return GetFileForUriAsync(context, url, isPhoto, false).ContinueWith(t =>
{
if (t.Result.Item1 == null)
return false;
if (url.Scheme == "content")
context.ContentResolver.Delete(url, null, null);
File.Delete(moveTo);
File.Move(t.Result.Item1, moveTo);
return true;
}, TaskScheduler.Default);
}
tested also in Forms app and works ok. Just changed this code and rebuild with bootstrapper.ps1. Then replaced binaries in Nuget folder and done
Thanks @RadekVoltr for looking into this as it was hard since I couldn't rep. Will push out new beta package asap
Thanks guys for sticking with it.
Please help @jamesmontemagno . Im experiencing an error like this on Version 3.1.1 Android: 6.0.1 Android Build: M4B30Z Manufacturer: LGE Model: Nexus 5 Security Patch: October 5, 2016
Xamarin caused by: android.runtime.JavaProxyThrowable: Plugin.Media.Abstractions.MediaFileNotFoundException: Unable to locate media file at content://media/external/video/media/3696
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at Plugin.Media.MediaImplementation+
@jamesmontemagno Im also experiencing error like this on my Nexus 6p device Android 6.0 Android Build: @MDB08K Manufacturer: Huawei Model: Nexus 6P Security patch: 1 October 2015
Plugin.Media.Abstractions.MediaFileNotFoundException has been thrown
Unable to locate media file at content://media/external/video/media/32740
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at Plugin.Media.MediaImplementation+<TakeVideoAsync>d__19.MoveNext () [0x000bc] in C:\projects\mediaplugin\src\Media.Plugin.Android\MediaImplementation.cs:268
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <4b2a558a9baf4ccdb2f086ffbd09a927>:0
Xam.Plugin.Media 3.1.3 as well:
Package: com.oneiota.consumerapp Version Code: 88 Version Name: 1.5.3 Android: 7.1.1 Android Build: NMF26X Manufacturer: samsung Model: SM-N950U CrashReporter Key: 03e44531-2cbc-43bf-8739-4466c71205d0 Start Date: 2018-01-31T15:43:27.197Z Date: 2018-01-31T15:45:50.864Z
Xamarin Exception Stack:
Plugin.Media.Abstractions.MediaFileNotFoundException: Unable to locate media file at content://media/external/images/media/2494
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
at Plugin.Media.MediaImplementation+
Will need someone to debug the source code as of the 5 android devices I have none of them have 6.0.1 on them.
I'd like to help on this as I'm getting reports my app is crashing as well because of this issue. I'm very confused however on which Android version I should be testing. @jamesmontemagno Based on @ryanherman response above this appears on Android 7.1.1 as well, not just on Android 6.0.1
Is there a way to replicate this on an emulator? On all of the devices I have the crash does not occur.
I just tried on Android 7.1.1 on emulator and it does not occur.
Has anyone successfully replicated this on an emulator? If yes, which Android? Would be great to have an exact repo to test.
on the nexus 5 the same problem turned out to be the reason in the standard camera app, put another app and through it shooting is normal
I'm also hitting this issue on Nexus 5, Android 6.0.1 Oct 05 2016 Patch Level Tried it with latest MediaPlugin Beta (4.3.0) but same issue.
As said above, changing the camera app solves the problem. I tried "Open Camera" and it worked. However, it didn't respect the DesiredLength setting. Any recomendations for alternative camera working on Nexus 5, without Ads and respecting DesiredLength?
There is some issue when you use the FileProvider with this plugin in Android versions lower than 7.0. The URL that is created is not working, it seems that there is some permissions issue. I have two physical phones (Samsung S4 and Samsung Galaxy Prime, both Lollipop 5.0 and 5.1) that were not working due to this problem. I tried to fix the permissions issue to use the FileProvider but I couldn't so I fix it avoiding the FileProvider at all in Android Versions lower than 7.0. Now I have both phones working without side effects!
Unfortunately, you have to touch the source code to get the fix.
Use this code
From @swansca79 on May 10, 2016 13:0
Please take a moment to fill out the following (change to preview to check or place x in []):
This is a
Which plugin does this impact:
Version Number of Plugin: 2.3.0 Device Tested On: Nexus 6P 6.0.1 w/ April Security patches Simulator Tested On:
Expected Behavior
Taking a video should return a MediaFile result.
Actual Behavior
Always returns null.
Steps to reproduce the Behavior
When this was originally implemented it worked, and all I can say for sure was that it was before the April security patches on my Nexus 6P. This bug does not happen on pre-marshmallow devices.
Copied from original issue: jamesmontemagno/Xamarin.Plugins#297