Hello! If you can still reproduce the issue on latest releases of Unity, could you please submit a bug report with a minimal reproduction project for this issue and reply in here with the issue ID?
I have the same issue on android 10 (Pixel 3a, Built by Unity 2018.3.12f1)
Playing movie by streaming works well.
Handheld.PlayFullScreenMovie works well too.
Playing movie by VideoPlayer on local storage (temporaryCachePath and persistentDataPath) doesn’t work.
videoPlayer.errorReceived
reports
VideoPlayer cannot play url : file:///....
Cannot read file.
Exact same issue here, Unity 2017.4.29f1 (LTS). It is working perfectly fine iOS and Android except Android 10. The video file is accessible at the expected url and I can play it manually.
Relevant logs:
10-07 11:19:24.621 14231 14302 E NdkMediaExtractor: can’t create http service
10-07 11:19:24.621 14231 14302 W Unity : AndroidVideoMedia: Error opening extractor: -10002
10-07 11:19:24.621 14231 14302 W Unity :
10-07 11:19:24.621 14231 14302 W Unity : (Filename: Line: 524)
10-07 11:19:24.621 14231 14302 W Unity :
10-07 11:19:24.672 14231 14274 E Unity : MediaView :: VideoPlayerOnErrorReceived ERROR : VideoPlayer cannot play url : /storage/emulated/0/Android/data/com.privatebundle.id/files/0xfLAYfU.mp4
10-07 11:19:24.672 14231 14274 E Unity : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[ ])
10-07 11:19:24.672 14231 14274 E Unity : UnityEngine.Logger:Log(LogType, Object)
10-07 11:19:24.672 14231 14274 E Unity :
10-07 11:19:24.672 14231 14274 E Unity : (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/Android/runtime/DebugBindings.gen.cpp Line: 51)
edit: I reproduced the issue in a very small project. The key is simply to put a valid .mp4 file into Application.persistentDataPath + “/myvideo.mp4”. I pasted my file directly in that folder. It works perfectly fine on my galaxy s8+ (android 9.0). Then I tried on Pixel 2 (android 10.0) and I have the exact error above.
edit 2: I had an idea. At runtime, I load the video file using WWW request.
The byte[ ] length is correct. Then, I do the following:
string destinationPath = System.IO.Path.Combine(Application.temporaryCachePath, “temp.mp4”);
File.WriteAllBytes(destinationPath, www.bytes);
Then I pass the temporaryCachePath URL to the video player. Exact same issue…
10-07 15:58:03.161 10661 10751 E NdkMediaExtractor: can’t create http service
10-07 15:58:03.162 10661 10751 W Unity : AndroidVideoMedia: Error opening extractor: -10002
10-07 15:58:03.175 10661 10683 E Unity : VideoOnErrorReceived ERROR: VideoPlayer cannot play url : /storage/emulated/0/Android/data/com.mycompany.videoplayerandroidpie/cache/temp.mp4
The same problem occurred in webm (vp8).
I think that the problem is that you can not access at file: /// on android10. I don’t see any manifests to avoid, so I’d like somehow.
It has been confirmed that it has not been resolved in all of 2018.4.1f1 to 2018.4.10f1.
I’m experiencing the same issue. Also trying to pass a cached video url to the VideoPlay on a device running Android 10. I know Unity has said this is working per design, but the suggested modification to the Android Manifest has not resolved the issue…
Also experiencing the same issue. Video is not playing on Android Q / Pixel 2 when using a local filesystem url. Remote URLs are working just fine. Permissions are correctly set, and videos are playing on any other device/OS.
Just for experiment fixed permissions, set properly but video still can’t be player with a same error message. So the only way is to await for bug fix.
After digging into the issue more and reading some Android logcats, I’m guessing the issue won’t be resolved by setting a certain permission (I’ve tried a bunch) but is related to the privacy and scoped storage changes Android made in 10/Q. I did a quick test, made a native android plugin using the getExternalFilesDir() command and passing the resulting path the Unity VideoPlayer, but that still results in a -10002 error and the video not playing. I think the issue has to do with how the VideoPlayer uses the URL to retrieve the video from the device. Read more about the Android Q changes here: https://developer.android.com/about/versions/10/privacy/changes
I would love to hear from someone at Unity regarding this…
Hi again!
The submitted case (1189995) has been resolved as a duplicate of another issue, which is already fixed in 2019.2.11f1, 2019.3.0b8, 2020.1.0a9 and above. Currently, the fix is also planned for 2017.4 and 2018.4 streams. You can find more information here:
Awesome! Thank you for the update! When can we get a download for Unity 2019.2.11f1? The latest I’m seeing in the Hub and download archive is 2019.2.10.