Search Unity

5.6 Video Player Not Working On Galaxy S3 (API 18)

Discussion in 'Android' started by yasirkula, Apr 4, 2017.

  1. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Hi there,

    I have a simple question: does Unity 5.6 video player support streaming video from local path in API levels prior to 21? I could not find a minimum system requirements for the video player and thus, I am asking it here.

    When I try to play a video from a local path in a newer Android device, it works almost perfectly (loop stops working after a while). When tested on Galaxy S3 API 18, I get the following output in logcat and video does not play:

    Code (CSharp):
    1. W/Unity   (12443): AndroidMediaNDK could not load symbol AMediaFormat_new, will stop loaing NDK.
    2. W/Unity   (12443):
    3. W/Unity   (12443): (Filename:  Line: 47)
    4. W/Unity   (12443):
    5. W/Unity   (12443): AndroidMediaNDK: libmediandk.so not loaded.  NDK-based video playback disabled.
    6. W/Unity   (12443):
    7. W/Unity   (12443): (Filename:  Line: 24)
    8. W/Unity   (12443):
    9. W/Unity   (12443): Android media NDK not available in API level 18.  Level 21 or more needed. Will use JNI instead.
    10. W/Unity   (12443):
    11. W/Unity   (12443): (Filename:  Line: 33)
    12. W/Unity   (12443):
    13. W/Unity   (12443): AndroidMediaJNI got error: java.lang.NoSuchFieldError: no static field with name='KEY_LANGUAGE' signature='Ljava/lang/String;' in class Landroid/media/MediaFormat;
    14. W/Unity   (12443):
    15. W/Unity   (12443): (Filename:  Line: 21)
    Thanks :)
     
  2. Truescape

    Truescape

    Joined:
    Sep 13, 2012
    Posts:
    4
  3. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Found the answer on 5.6 changelog:

     
  4. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi yasirkula,

    The VideoPlayer is indeed supported from API level 16. But there are many bugs present in Android's implementation of the movie decoding in 4.1-4.3 (16-18) for which we are implementing workarounds at the moment. This is why you see the note about 4.4+ in the release notes, although I do have a Galaxy S3 API 18 that plays 1080P properly. We'll include these workarounds in the 5.6 patch releases as they become available.

    The behaviour depends on many things, including the codec (VP8 or H.264), the specific codec parameters (resolution, H.264 profile/level being the main ones) as well as presence/absence of audio tracks.

    About the specific messages you are seeing in your logcat, they can be ignored:
    • The NDK message is just saying that, out of the 2 ways Unity can use the Android movie decoding libraries, the most efficient one (NDK) is not available and we thus revert to the other one (JNI). Maybe I should reformulate so it appears less scary...
    • The KEY_LANGUAGE message is saying that we tried to obtain the audio track language (so your code can, say, select the wanted language in case there are alternatives) but it wasn't specified in the track. Again, this may be unneeded verbosity that I can rework.
    There may be further error/warnings that explain why this specific video is not working. You can post them here if you can spot them: they should all start with the string "AndroidVideoMedia".

    If possible, please share the non-working video with us through a bug report. This way we can make sure we nail the cause of the problem (or explain how come this video may not be played on the device). The looping problem is also worth logging (with a video that exposes the issue).

    Keep in mind there are recommendations on how a movie should be encoded in order to play well on Android devices: https://developer.android.com/guide/topics/media/media-formats.html#recommendations

    Individual vendors are of course free to go above these recommendations, but this will be on a per-vender/device basis.

    Hope this helps, and thanks for letting us know!

    Dominique
    A/V developer at Unity
     
    yasirkula likes this.
  5. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Hi Dominique,

    Thank you for the detailed answer; that was very enlightening. I'll keep you updated when I submit a bug report or find anything new on my side.

    U are the best! :D
     
  6. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    @yasirkula When you report a bug, please mention the exact model number of the Samsung Galaxy S3
     
    yasirkula likes this.