Search Unity

Video Videoplayer: Android playing local video file broken

Discussion in 'Audio & Video' started by ninjanosui, Feb 24, 2020.

  1. ninjanosui

    ninjanosui

    Joined:
    Jul 12, 2013
    Posts:
    54
    Hi,

    I have a serious problem with playing local videos, I tried several Unity versions and now try with the latest 2019 version (2019.3.2f1).

    Logcat gives me :
    E/NdkMediaExtractor: can't create http service
    W/Unity: AndroidVideoMedia: Error opening extractor: -10002

    While Handheld.PlayFullScreenMovie(url) works fine with the same url.

    Is there any fix for this? I tried several things like removing the : "file://" prefix.

    Help!

    Regards,
    Steven
     
  2. Jackiedg

    Jackiedg

    Joined:
    Jul 10, 2018
    Posts:
    3
  3. ninjanosui

    ninjanosui

    Joined:
    Jul 12, 2013
    Posts:
    54
    managed to fix it after all with removing the "file://" and updating the packages

    Code (CSharp):
    1.         while(!videoPlayer.isPrepared)
    2.         {
    3.             yield return null;
    4.         }
    5.         //image.texture = videoPlayer.targetTexture;
    6.         int width = videoPlayer.texture.width;
    7.         int height = videoPlayer.texture.height;
    8.         RenderTexture renderTexture = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32);
    9.         videoPlayer.targetTexture = renderTexture;
    10.         videoPlayer.Play();