简体   繁体   中英

Streaming byteArray video in Android

How can I stream video from byteArray

fun streamVideoListener(frame: ByteArray){
        // receiving H.264 frames every 100ms.
}

I tried FFmpeg library. merged 100 frames and make few seconds video and add it to ExoPlayer playlist. but performance is not good at all. I also tried NanoHttpd library. I can send a simple .mp4 video file and play it with vlc or MxPlayer, but don't know how to stream a growing video file (without refreshing page)

You'll need to implement a custom DataSource implementing the com.google.android.exoplayer.upstream.DataSource interface or extend the BaseDataSource from exoplayer library. Store the byte array and in the read method provide the stored byte array. You can see usage in the RtmpDataSource class of the exoplayer library

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM