Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Anyone Got video Player working in Android?

Discussion in '5.6 Beta' started by mattSydney, Mar 6, 2017.

  1. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    If so could you reproduce the steps please.

    I have tried in b09 (crashes android device on play) and b10. Black object instead of video playing. The video plays in the trial version of the Unity store asset AVPro video.

    Also I downloaded the Unity demo posted at the top of the forum, same result (crash).

    Tested on Galaxy S6 Edge
     
    zulfikerali likes this.
  2. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    Hi Matt!

    Sorry you're having trouble with playback on Android, an important rework was done for b10, but is missing one important bug fix having to do with clips not starting when the timestamp of the first frame is not 0. Many clips have their first frame start at frame 1 which trips some logic in our Android decoding implementation. This is fixed in the next version (beta 11).

    It would be helpful if you can test with videos that start at 0 (here's an example):
    http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v

    Thanks for helping,

    Dominique
    A/V developer at Unity
     
    zulfikerali likes this.
  3. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Hi Dominique

    Thanks for the reply. I tried the video you suggested on b10. No crash but the video isn't playing (black gameobject). Works fine in the editor. I have tried a few transcoding options with same result.

    Tested Galaxy S6 Edge running Android 6.01

    Matt
     
  4. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    OK, thanks for trying out. Can you also try both with GLES2 and GLES3 Graphics APIs?

    There si a GL extension that has to be present for the decode-to-texture to work, and GLES2 and 3 each have their on flavour of the extension. If you have time, please submit a bug with the project as well as the logcat from your device so we can make sure we cover this scenario in our tests.

    Thanks for your patience!

    Dominique
    A/V developer at Unity
     
    Cromfeli likes this.
  5. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Hi

    Yes sort of works! To clarify...

    VideoAPI will not play on Android device Galaxy S6 Android version 6.0.1 when Auto Graphics Api is selected in player settings.

    However the video plays when AutoGraphicsAPI is unchecked and the are added separately, but there is no sound.

    Submitting bug report with logcat now

    Cheers

    Matt
     
  6. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    Hi Matt,

    Thanks for taking the time to dig through this. For the audio to work, did you use the "Audio Source" Audio Output Mode? The "Direct" Audio Output Mode doesn't yet work outside of OSX / iOS, so you have to assign an Audio Source to the Video Player (in the UI or through scripting) for the audio to be heard on Android. I've recently added a warning in the console when we detect the direct mode being used in a context where it isn't yet supported.

    When you have the bug id you submitted, please post it to this thread so everyone can follow its progress.

    Dominique
     
  7. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Ah thanks the Audio Source works! Is that noted in the video draft docs? I may have missed it.

    Bug ID- (Case 888657) New Video API will not play on Galaxy S6 when AutoGraphics Api is checked
     
    LeonhardP likes this.
  8. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    Excellent, thanks Matt for trying this out!

    So this leaves us with:
    • We have to see what we can do about GLES3 being selected by default when Auto Graphics API is on and preventing the GLES2 API from being used (the bug you logged).
    • We need to document that direct output doesn't work (yet) on Android. In fact, it only works for OSX / iOS for now, and I've added a warning about this that is sent to the log, but of course on your device it will be rather subtle: it goes to the device's log. This feature will be implemented in a future release.
    Anything else?

    Dominique
    A/V developer at Unity
     
  9. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Yes I think so. To clarify, when you uncheck Auto Graphics API and are left with OpenGLES2, OpenGLES3, and Vulkan in the list. (i.e. you don't have to remove any of the API's ) The video plays fine with all 3 in the list.

    It doesn't play when Auto Graphics API is checked
     
  10. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    OK, thanks for the clarification. We'll have to see in what order the APIs are tried and how the VideoPlayer can influence the choice of the graphics API at startup time.

    Dominique
    A/V developer at Unity.
     
  11. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    Hi again,

    Follow-up: for anyone following this situation, the workaround really is to force the Graphics API to GLES2 because on devices that don't have full support for GLES3 (including the GL_OES_EGL_image_external_essl3 extension), the VideoPlayer will not work. We'll have to devise a solution for having the VideoPlayer work on GLES3 implementations that don't have this extension (at least one solution comes to mind, but has performance implications) but meanwhile, please force the Graphics API to GLES2 when faced with this problem.

    Dominique
    A/V developer at Unity.
     
    ZpetsnaZ likes this.
  12. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,080
    Using Unity 5.6.0b11
    forced GLES 2 errors a lot after preparing and playing the video from web url
    disabled automatic graphics API, left the list untouched: Vulkan, GLES 3, GLES 2 it still errored
    Automatic graphics API turned on still doesn't play video.

    Either situation on a Nexus 5 I could not get it working on android.
    Sidenote: have not tried the video you linked before.

    With automatic graphics API it does prepare the video, when play is called it will still be a black screen because it could not find video decode shader pass.
     

    Attached Files:

  13. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    Hi MaskedMouse,

    Thanks a lot for taking the time to report this, I'll see what we can do to reproduce locally with a similar device. I am working on a number of improvements to this situation that will be tested in the upcoming days. If you can, please report details about your device (exact model, OS version) so we can make sure to correctly cover this.

    Note that with the version you are using, the only "valid" configuration for testing is keeping auto graphics API off and only leaving GLES 2 in the list. The version I am working on right now should let you use both GLES2, GLES3 or Auto. Of course there is a lot of variability in the video playback world on Android, so we cannot be sure for every device, but we're doing everything we can to improve this.

    Dominique
    A/V developer at Unity.
     
    Last edited: Mar 16, 2017
  14. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,080
    So I went and re-created the build with GLES2 only to try again and used the http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v
    Seems to work fine now (don't know why it didn't before, maybe it was an other mp4 url that didn't work).
    So can't reproduce it at this moment. If I can I'll be sure to make a bug report of it.

    Would be nice to see GLES3 going (or vulkan, whatever is better for performance).
    I'm looking forward to the release and stability of the video player.
    As I think this has a lot more potential than the 'Easy Movie Texture' plugin ever had.
     
  15. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    GLES3 on Nexus 5 has been tested locally and now works. We're making every effort for these improvements to make it in time for the 5.6 release. Vulkan is an entirely different discussion however and is not supported by the Android VideoPlayer for now.

    Thanks for your time,

    Dominique
    A/V developer at Unity.
     
  16. stich34

    stich34

    Joined:
    Nov 11, 2016
    Posts:
    7
    Maybe this is a related issue?
    I was encountering the same blank video screen as the earlier threads (unity ver 5.6.0f1), and suggested solution of using GLES2 also fixed the problem for me. But it seems the same issue with videoPlayer is now re-occuring when implementing Google GVR SDK for Unity v1.30. Anyone also using gvr camera and encountering similar issue?
     
  17. corin_w

    corin_w

    Joined:
    Mar 29, 2017
    Posts:
    5
    Hi Dominique, I'm still having trouble with VideoPlayer when using a project set up for google cardboard. On Nexus 5x 7.1. The video player functionality seems stable in a completely bare project, but starts to break down especially when streaming, if there is more going on. I have a test case and a logcat if you're interested.
     
  18. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    Hi Corin!

    Yes, I'm really interested, thanks for the offer!

    Would you mind submitting the project as a bug report so we have all the info (Unity version, project, logcat) at the same place? It helps with internal communication and prioritization as well and makes it easier to enlist the help of QA and support teams.

    I understand that performance problems start to creep up as you raise complexity, but it would make profiling and general investigation easier if you kept the simplicity level as low as possible - while keeping the performance problems visible of course.

    It could be that the solution resides in using a more lightweight video, but it will be a good exercise to go through your project to see if there are any low-hanging fruits.

    Note that the closest device I have to test this is a Nexus 6 running 6.0.1. Think this is an adequate substitution?

    Dominique
     
  19. corin_w

    corin_w

    Joined:
    Mar 29, 2017
    Posts:
    5
    I've submitted a bug report and attached a project and logcat.
    I believe the video we're trying to stream is 360p and, while quite long, I'm having issues before the first frame is visible.

    The log cat has a whole host of GLES enum argument out of range errors after the line "makeComponentInstance(OMX.google.aac.decoder) in mediacodec process" so I believe this is a decoding issue rather than a memory problem.

    I have a range of devices here, the 5x is the worst of the lot the 6p has been fine. Pixel is somewhere in between. I hope this helps you guys to track this down.

    Corin
     
  20. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    259
    Thanks for submitting this! 360p is definitely reasonable so we should be able to do something.

    Also please add the bug id on this thread so I can go have a look asap.

    About the OMX.google.aac.decoder, this is a audio-related message (AAC being the audio codec for audio streams that normally accompanies H.264 video streams), so this is likely not related to the GL error.

    Dominique
     
  21. corin_w

    corin_w

    Joined:
    Mar 29, 2017
    Posts:
    5
    Hi Dominique,

    Bug ID is 896208.

    thanks, Corin