Search Unity

Video error VideoPlayer on Android

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

  1. charcreon

    charcreon

    Joined:
    May 14, 2013
    Posts:
    4
    I can't play video on android.
    unity 2018.4.1f1
    android 10 (pixel3)

    Code (CSharp):
    1. void Play()
    2. {
    3.     videoPlayer.source = VideoSource.Url;
    4.     var filePath = string.Format("file://{0}/0.mp4", Application.temporaryCachePath);
    5.     videoPlayer.url = filePath;
    6.     Debug.LogFormat("[VideoManager] [Play] filepath:`{0}`", filePath);
    7.  
    8.     videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
    9.     videoPlayer.EnableAudioTrack(0, true);
    10.     videoPlayer.SetTargetAudioSource(0, AudioManager.Instance.VideoAudioSource);
    11.  
    12.     videoPlayer.prepareCompleted += PrepareCompleted;
    13.     videoPlayer.errorReceived += ErrorReceived;
    14.  
    15.     videoPlayer.enabled = true;
    16.     videoPlayer.Prepare();
    17. }
    18.  
    19. void PrepareCompleted(VideoPlayer vp)
    20. {
    21.     vp.prepareCompleted -= PrepareCompleted;
    22.     vp.errorReceived -= ErrorReceived;
    23.     vp.Play();
    24. }
    25.  
    26. void ErrorReceived(VideoPlayer vp, string message)
    27. {
    28.     vp.prepareCompleted -= PrepareCompleted;
    29.     vp.errorReceived -= ErrorReceived;
    30. }
    31.  
    adb logcat
    Code (CSharp):
    1. 09-10 07:54:05.423  1701  1785 I Unity   : [VideoManager] [Play] filepath:`file:///storage/emulated/0/Android/data/com.xxxx.xxxx/cache/0.mp4`
    2. 09-10 07:54:05.423  1701  1785 I Unity   : VideoManager:Play(Int32, Single, Boolean)
    3. 09-10 07:54:05.423  1701  1785 I Unity   :
    4. 09-10 07:54:05.423  1701  1785 I Unity   : (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    5. 09-10 07:54:05.423  1701  1785 I Unity   :
    6. 09-10 07:54:05.449  1701  1823 E NdkMediaExtractor: can't create http service
    7. 09-10 07:54:05.449  1701  1823 W Unity   : AndroidVideoMedia: Error opening extractor: -10002
    8. 09-10 07:54:05.449  1701  1823 W Unity   :
    9. 09-10 07:54:05.449  1701  1823 W Unity   : (Filename:  Line: 471)
    10. 09-10 07:54:05.449  1701  1823 W Unity   :
    11.  
    Confirmed that the file exists
    I don't know the error code(-10002)
     
    kanehana likes this.
  2. takahiro-yamada

    takahiro-yamada

    Joined:
    Mar 22, 2016
    Posts:
    2
    me too

    Code (CSharp):
    1. AndroidVideoMedia: Error opening extractor: -10002
    Unity 2018.1.9f2
    Android10 Pixel3a
     
    kanehana likes this.
  3. bkachmar

    bkachmar

    Joined:
    Mar 15, 2013
    Posts:
    34
    I have the same error on my Pixel 3, Android 10.