[Bug] Output Folder "Photo Library" doesn't work on Android (again?)
Unity version
6000.0.32 and 2021.3.45
Unity editor platform
macOS
AVPro Movie Capture edition
Full
AVPro Movie Capture Version
5.3.3 Mobile Edition
Which Android OS version(s) are you using?
13, 14
Which graphics API(s) are you using?
OpenGLES 3
Hardware
Google Pixel 7a Samsung Galaxy A14-5G
Which capture component are you using?
Capture From Screen
Capture mode
Realtime
Which output mode are you using?
Video file
Video codecs
H264
Audio source
Microphone
Any other component configuration required to reproduce the issue.
No response
The issue
The Videos are NOT showing up in the picture gallery of my Samsung Galaxy A14 or Google Pixel 7a. I'm doing a ScreenCapture. It is working correctly on iOS. Output Target is set to "Folder: Photo Library". I'm using unity 2021.3.45 and Unity 6000.0.32. The videos are stored correctly under android's video folder but not showing up in Android Photo Gallery.
I know there was a bug requests about this topic already - and it should have been fixed: [Bug] Output Folder "Photo Library" doesn't work on Android #397
This behavior seems to be still a bug. Are there any plans to fix it. Or is it a user error on my side? Help is appreciated. Many thanks.
Edit: After some research I have read, that the Android MediaScanner has to be notified of the new file in the photo library, to display it correctly. Do you have any advice on this topic? Changing the Output Target to something else does not have any effect.
Edit: I found a workaround: What helps is calling after the video was saved in android: Then the video appreas in the android photo gallery: It would be great, if your plugin could handle this instead ;) Please. using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity")) { using (AndroidJavaObject context = currentActivity.Call<AndroidJavaObject>("getApplicationContext")) { using (AndroidJavaObject mediaScanner = new AndroidJavaClass("android.media.MediaScannerConnection")) { mediaScanner.CallStatic("scanFile", context, new string[] { videoPath }, null, null); } } } }
Log output
we are looking into this
Are you able to provide an unfiltered logcat for when its not working please?
Unable to reproduce this using:
- Unity 2021.3.45f1
- AVPro Movie Capture 5.3.3
- Devices:
- Samsung A50, Android 11
- Samsung A12, Android 11
- Samsung S21, Android 14
- Samsung S7, Android 8
- Google Pixel 4, Android 13
- Google Pixel 7a, Android 14
- Xiaomi Mi 10, Android 12
Make sure Update Media Gallery is enabled in the Android capture inspector, Post section.
We already use the MediaScanner so no changes required there.
Thanks for looking into this. I had not time yet but I will test this again. I am upgrading to Unity 6000 and will check this issue. I have enabled the „UpdateMediaGallery“ setting already. It is confusing why it is not working in my case. I will save my logcat log.
I can confirm, that a video captured from my app is now showing up in the Android Gallery correctly (Tested on a Samsung Galaxy A14 5G and Google Pixel 7a). I'm using Unity 6.0.32 and I have removed my "Android Media Scanner". In the "Capture from Screen" Component I have set the OutputPathType to "Photo Library".
But one thing is strange: the setting "AndroidUpdateMediaGallery" is not shown anywhere (neither in the POST Section) of the "Capture from Screen" Component in the Inspector. But I can see it only when switching the Unity Inspector to "Debug" Mode. Is it possible, that this setting is only shown in Unity 2021?