Search Issue Tracker

Fixed in 2020.1

Fixed in 2018.4, 2019.2, 2019.3

Fix In Review for 2017.4

Votes

0

Found in

2017.4

2018.4

2018.4.1f1

2019.2

2019.3

2020.1

Issue ID

1168329

Regression

No

[Android] Video Player cannot play files located in the Persistent Data directory on Android 10

Mobile

-

Repro steps:
1. Open QA attached project ” repro_1168329"
2. Build and Run on Android

Actual: An error is displayed on the screen stating that the file cannot be read

Reproducible with: 2017.4.32f1, 2018.4.8f1, 2019.2.5f1, 2019.3.0b3, 2020.0a4

Tested and reproduced on this device:
VLNQA00123, Google Pixel 2 XL (Pixel 2 XL), Android 10, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00153, Google Pixel XL (Pixel XL), Android 10, CPU: Snapdragon 821 MSM8996 Pro, GPU: Adreno (TM) 530

Didn’t reproduce on these devices:
VLNQA00262, Sony Xperia XZ Premium (G8141), Android 9, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00138, Huawei P20 Pro (CLT-L29), Android 8.1.0, CPU: HiSilicon Kirin 970, GPU: Mali-G72
VLNQA00012, Samsung Galaxy S6 (SM-G920F), Android 7.0, CPU: Exynos 7 Octa 7420, GPU: Mali-T760
VLNQA00002, Samsung Galaxy S5 Neo (SM-G903F), Android 6.0.1, CPU: Exynos 7 Octa 7580, GPU: Mali-T720

  1. Response avatar

    Resolution Note (fix version 2020.1):

    Fixed an Android 10 video player bug when playing local, external files. Th code change works around what appears to be a bug in Android MediaExtractor's setDataSource function in Android 10. It no longer seems to handle permissions correctly and fails when trying to load local, external files. Assets in the project work, but when trying to access a file local to the device, and the necessary permissions have been granted, it will still fail. Luckily, there is another setDataSourceFd function where we can open the file ourselves and pass in the file descriptor and that works reliably.

  2. Response avatar

    Resolution Note (fix version 2019.2):

    Fixed an Android 10 video player bug when playing local, external files. Th code change works around what appears to be a bug in Android MediaExtractor's setDataSource function in Android 10. It no longer seems to handle permissions correctly and fails when trying to load local, external files. Assets in the project work, but when trying to access a file local to the device, and the necessary permissions have been granted, it will still fail. Luckily, there is another setDataSourceFd function where we can open the file ourselves and pass in the file descriptor and that works reliably.

Comments (8)

  1. E38201e055f7186b920654ba5f6baafe?d=mm

    Babybus_Study

    Dec 11, 2019 02:31

    It seems that the latest version of 2017 still fails to solve this problem. When do you plan to fix it?

  2. 4a319782ca20ea89686501064e5dbb61?d=mm

    michaelsorgrr

    Dec 09, 2019 02:49

    Using 2018.4 LTS on a Pixel 1, I still get the same error "NdkMediaExtractor: can't create http service" when attempting to use a local filesystem url to play a video using a video player component.

    I tried removing "file://' prefix and adding "videoPlayer.source = VideoSource.Url", but to no avail.

    Is anyone else experiencing the same issue? If not am I missing how can it be resolved?

  3. Ef1e8297ca7ad97a231f97f8f4d0dab1?d=mm

    victorluishongchautest

    Dec 05, 2019 05:44

    For those that found the fix is not working even after the patch, try to use a local file path without the "file://" prefix. Without the "file://' prefix we handle things better.

  4. 051beb5c0bf0134b2e9fa6e544dc2d29?d=mm

    JCereda

    Nov 12, 2019 17:26

    Still broken in Unity 2018.4 LTS. We need a fix right now.

  5. C9e38bc812cbf23b69bc1c76aa95d5a2?d=mm

    kidzooly

    Nov 12, 2019 13:26

    Add
    videoPlayer.source = VideoSource.Url;
    videoPplayer.url = path;

    should resolve the issue.<VideoSource> is Unity's Class

  6. 739da9c0320c4bed8958a4709dbb45c4?d=mm

    cyliax

    Nov 05, 2019 08:17

    Just realized this bug on a new Pixel 3a with Android 10. We urgently need a fix for Unity 2018.4 LTS for all our apps. This is major issue.

  7. 37e5cfb091797183fde83fa26d5037bc?d=mm

    shrvnn1993

    Nov 04, 2019 05:47

    I downloaded Unity 2019.2.11f1, where it says that the issue is resolved for Android 10. But this doesn't seem to be solved in this version as well. The video is not playing on Android10 devices.

    Are there any extra steps that are to be taken to make it work? Like use another function/code snippet.

  8. E3092fa12cd8587ae7b4657e8c692e42?d=mm

    patildevendra761

    Oct 26, 2019 08:13

    setDataSourceFd seems to be a function of MediaPlayer in Android. How can we implement in Unity in order to play video from the local storage?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.