RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
226 stars 28 forks source link

Multiple video loading issues on android 10(Q) #544

Closed LightGather closed 3 years ago

LightGather commented 3 years ago

Describe the bug Multiple videos are not played on Android 10 (Galaxy s9+)

Your Setup (please complete the following information):

To Reproduce

  1. Load a video using OpenVideoFromFile(FileLocation.AbsolutePathOrURL, video0_path, false) at MediaPlayer0 instance;
  2. Load another video using OpenVideoFromFile(FileLocation.AbsolutePathOrURL, video1_path, false) at MediaPlayer1 instance;
  3. The first video is stopped After the second video is loaded. (Same code, No problem on Android 9. I just changed the target SDK because of a policy of google since Nov. Also, video loading and seeking speed are slower on Android 10, than on Android 9. I know that access policies of android is changed after Android 10. Should I do something to fix this problem?)
damonkim80 commented 3 years ago

I have the same problem. please review this issue.

Ste-RH commented 3 years ago

Can you provide the requested information please?

LightGather commented 3 years ago

Hi, I found a temporal solution. Add android:requestLegacyExternalStorage = "true" to a AndroidManifest file. This is the code that gives temporary permission to the storage path in Android 10. (https://forum.unity.com/threads/android-10-and-scoped-storage-missed-features-in-unity-2019.749333/) The strange thing is that without the code that grants this permission, the video shouldn't load at all. Because of this reason, The Unity video player cannot load external files on Android 10. But in AVPro Video, it loads, but it works as if there is something wrong. Regarding video format, I found these issues for various video formats (I tested more than 30 different videos). I guess that it's not a problem of specific video resolution or codec.

Ste-RH commented 3 years ago

This is interesting, I would have thought setting 'Write Permissions' in Unity 'Player Settings' would do the trick.

Maybe checking/requesting permissions might help? Info here

Ste-RH commented 3 years ago

@damonkim80 Can you confirm the fix suggested by @LightGather addresses your use-case as well?

damonkim80 commented 3 years ago

@RenderHeadsSte Yes. I've fixed it. :) but It doesn't seem to be perfect solution. please keep checking it on new version.