Search Unity

Video Really weird issue on Android: .mp4 file don't play... Error opening extractor: -1000

Discussion in 'Audio & Video' started by danielesuppo, Feb 19, 2018.

  1. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    168
    Hello,
    I have a very simple GearVR app that play a .mp4 file, from mobile.
    This video is on the persistentDataPath of another App.
    I never had problems with it, and I made a lot of builds with different Unity versions.
    Now I've just upgraded to Unity 2017.3.1f1 (I don't know if this is the problem), and the videoplayer can't play anymore this .mp4 file, if it's not in the persistentDataPath of the App.
    I just get the error "Error opening extractor: -1000"

    I did a lot of test, just to be sure that this was the problem (a "path" problem), and yes, it is.

    Here is my soo simple code...
    Code (CSharp):
    1. void Start () {
    2.         string dataPath = Application.persistentDataPath;      
    3.        
    4.         //If I remove the line below the file can play... really weird...
    5.         dataPath = dataPath.Replace("VR", "");
    6.  
    7.         if (System.IO.File.Exists(dataPath + "/video/Whalon Lake.mp4"))
    8.         {
    9.             fileCheck.text = "EXIST";
    10.         }
    11.         else
    12.         {
    13.             fileCheck.text = "DO NOT EXIST !!!!";
    14.         }
    15.  
    16.         videoPlayer.url = dataPath + "/video/Whalon Lake.mp4";
    17.         videoPlayer.Play();
    18.     }
    As you can see I'm checking if the file exist, and yes, it exist, the file is working, and I have no problems to play it from the "regular" persistentDataPath of the App.

    Again, I've always use this code, with the same .mp4 file, and the same path, it just now that it does not work anymore...
    Maybe someone have some suggestion on it? I'm getting crazy...
    Thank-you!
     
  2. thilde09

    thilde09

    Joined:
    Aug 9, 2018
    Posts:
    1
    Hi,
    I'm running into the same issue with an Oculus Go. I want to access a video file from internal storage of the Oculus Go. File exists, but doesn't play. Did you find a solution for that?

    Using Unity 2017.4.1
    ErrorMessage: AndroidVideoMedia: Error opening extractor: -10000

    Thanks.
     
    hisahisa likes this.
  3. edegut

    edegut

    Joined:
    Jul 25, 2018
    Posts:
    1
    same issue, any news?
     
  4. eris8x6

    eris8x6

    Joined:
    Apr 2, 2019
    Posts:
    1
    I have had this problem, also. There was a change in the way Android handles file system permissions, and I think you have to figure out how to get the Android manifest for your app to request the proper permissions in order to read files from storage that are outside of the folder earmarked for the app. Not sure how to do that; I haven't got it working yet.
     
  5. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    168
    I've ended with a double version, one VR and another not VR
     
  6. shashkes

    shashkes

    Joined:
    Mar 16, 2017
    Posts:
    12
    was struggling for hours then found this vid:

    added on awake
    Caching.compressionEnabled = false;
    there is something about android videos needing to not be compressed and even if the bundle file isn't compressed the caching can be...
    after hours and hours i found this vid

    here is my code

    public class LoadFromFileAsyncExample : MonoBehaviour
    {
    public VideoPlayer MyPlayer;
    public bool mclearcash;
    private void Awake()
    {
    Caching.compressionEnabled = false;
    if (mclearcash)
    {
    Caching.ClearCache();
    }
    }
    IEnumerator Start()
    {
    var bundleLoadRequest = AssetBundle.LoadFromFileAsync("/sdcard/Android/obb/com.Live.Training/Door.1.com.Live.Training.obb");
    yield return bundleLoadRequest;
    var myLoadedAssetBundle = bundleLoadRequest.assetBundle;
    if (myLoadedAssetBundle == null)
    {
    Debug.Log("Failed to load AssetBundle!");
    yield break;
    }
    var assetLoadRequest = myLoadedAssetBundle.LoadAssetAsync<VideoClip>("Door");
    yield return assetLoadRequest;
    VideoClip vid1 = assetLoadRequest.asset as VideoClip;
    MyPlayer.clip = vid1;
    MyPlayer.Play();
    myLoadedAssetBundle.Unload(false);
    }
    }