niqdev / ipcam-view

MJPEG video streaming on Android
https://goo.gl/a2HM8C
MIT License
408 stars 160 forks source link

How to convert output of ipcam-view to Bitmap? #193

Open MhmudAlpurd opened 2 years ago

MhmudAlpurd commented 2 years ago

Hi @niqdev, thank you for this library. I need to use the output of ipcam-view as bitmap. Could you guide me on how to do it, please?

witti-stephen commented 1 year ago

What I explored that might work is using the onFrameCapturedListener object, sample code as follow:

    val view: MjpegSurfaceView = binding.mjpegView
    view.setOnFrameCapturedListener(object: OnFrameCapturedListener {
        override fun onFrameCaptured(bitmap: Bitmap) {
            // do you action here
            Log.i("this","hihi")
        }
        override fun onFrameCapturedWithHeader(bitmap: ByteArray, header: ByteArray) {
            // do you action here
            Log.i("this","hihi2")
        }
    })