Android: simultaneous playback of a large number of videos

I am developing a chat, and we have high-quality emoticons with the mp4 extension (file size about 300 KB). GIF is not used due to poor quality and limited colors (256).
I need to display files in a ListView as a loop video. Now I am trying to do this using the TextureView and MediaCodec classes. Sources can be found at https://github.com/google/grafika .
The problem is that when trying to play more than 4 videos, an IllegalStateException error occurs in android.media.MediaCodec.dequeueOutputBuffer at the same time . I think this is due to the large memory consumption, on my device (HTC ONE M7) when playing four videos, the processor is more than 60% loaded!  
How can I solve this problem? Maybe I need to use third-party codecs?
Or is the idea of ​​using video to display emoticons a bad one, and I need to abandon it and use something like GIF?

+4
source share
1 answer

There is a limit on the number of simultaneous decoders, if for some reason you exceed the maximum hardware bandwidth. On some devices, I saw him switch to software decoding after setting up two hardware decoders. AFAIK there is no forced behavior.

, .mp4. SurfaceTexture, . , , , , .

: , 'M' MediaCodecInfo.CodecCapabilities.getMaxSupportedInstances(), " ". , , , . , API .

+1

All Articles