Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Video error VideoPlayer on Android

Discussion in 'Audio & Video' started by charcreon, Sep 10, 2019.

  1. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    282
    Hi, still the same problem in Unity version 2019.4.3f1
    Code (CSharp):
    1. 2020/07/10 20:24:51.603 8430 8620 Error NdkMediaExtractor can't create http service
    2. 2020/07/10 20:24:51.603 8430 8620 Warn Unity AndroidVideoMedia: Error opening extractor: -10002
    3. 2020/07/10 20:24:51.603 8430 8620 Warn Unity (Filename:  Line: 469)
    4. 2020/07/10 20:24:51.603 8430 8620 Warn Unity
    5.  
    Screen Shot 2020-07-10 at 20.26.28.png
     
  2. gtara

    gtara

    Joined:
    Nov 5, 2015
    Posts:
    2
    Hi everyone. I have the same issue too.

    So can you reproduce a local video file with Videoplayer in Android 10?
    How did you fix it? :)

    Thanks
     
    Last edited: Jul 28, 2020
  3. Joy0023

    Joy0023

    Joined:
    Oct 30, 2017
    Posts:
    4
    Same issue Unity 2019.2.3f1, using both file from device and https url for Video player, same Exctractor error -10002,
    HELP
     
  4. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    282
    Hi guys,

    I managed to fix this issue, in my case, the problem was "URL" for the final path I used:
    Code (CSharp):
    1. VideoPlayer.url = "file://" + _url;
    -I removed "file://" from the final path string and now all works perfectly.

    Hope this will help somebody!
     
  5. gtara

    gtara

    Joined:
    Nov 5, 2015
    Posts:
    2
    Hi @InfinityCoder88 , thanks for the reply! :)
    I checked it but without any success. In my project i have built the path using Application.persistentDataPath, so it is like /storage/emulated/0/Android/data/<packagename>/files

    It didn't contain "file://", so probably the problem can't be there.
    Could you share the code of your working example please?

    If your application works on Android 10, maybe there are other things that hide the trick! :D

    Thank you very much!!
    Roberto
     
  6. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    282
    Hi Roberto,

    In my project, I use Native Gallery for Android & iOS it's a free and very powerful plugin you can use to pick up files from native galleries on Android/iOS. In my case, another plugin overwrite the path by adding "file://" in URL.

    My workflow:

    My code:
    Code (CSharp):
    1. public void SelectVideoFromGallery()
    2. {
    3.             NativeGallery.GetVideoFromGallery(OnVideoPicked);
    4. }
    In Native Gallery:
    Code (CSharp):
    1. public static Permission GetVideoFromGallery( MediaPickCallback callback, string title = "", string mime = "video/*" )
    2.     {
    3.         return GetMediaFromGallery( callback, MediaType.Video, mime, title );
    4.     }
    5.  
    6.     private static Permission GetMediaFromGallery( MediaPickCallback callback, MediaType mediaType, string mime, string title )
    7.     {
    8.         Permission result = RequestPermission( true );
    9.         if( result == Permission.Granted && !IsMediaPickerBusy() )
    10.         {
    11. #if !UNITY_EDITOR && UNITY_ANDROID
    12.             string savePath;
    13.             if( mediaType == MediaType.Image )
    14.                 savePath = SelectedImagePath;
    15.             else if( mediaType == MediaType.Video )
    16.                 savePath = SelectedVideoPath;
    17.             else
    18.                 savePath = SelectedAudioPath;
    19.  
    20.             AJC.CallStatic( "PickMedia", Context, new NGMediaReceiveCallbackAndroid( callback, null ), (int) mediaType, false, savePath, mime, title );
    21. #elif !UNITY_EDITOR && UNITY_IOS
    22.             NGMediaReceiveCallbackiOS.Initialize( callback );
    23.             if( mediaType == MediaType.Image )
    24.                 _NativeGallery_PickImage( SelectedImagePath );
    25.             else if( mediaType == MediaType.Video )
    26.                 _NativeGallery_PickVideo( SelectedVideoPath );
    27.             else if( callback != null ) // Selecting audio files is not supported on iOS
    28.                 callback( null );
    29. #else
    30.             if( callback != null )
    31.                 callback( null );
    32. #endif
    33.         }
    34.  
    35.         return result;
    36.     }
    Hope this will help you, I highly recommend you to use this plugin!
     
unityunity