Skip to content Skip to sidebar Skip to footer

Android Mjpeg Stream

I have implemented Android and MJPEG and also implemented async and certifications to run it that is mentioned here. Now i have managed to run the jpeg video stream but the issue i

Solution 1:

I have implemented a library to play MJPEG video streaming on Android. All source code is available on GitHub ipcam-view.

Add the dependency to your app

compile'com.github.niqdev:mjpeg-view:0.3.3'

Here an example of how use it, add MjpegSurfaceView to your layout

<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
  // ADDTHISxmlns:stream="http://schemas.android.com/apk/res-auto"...><com.github.niqdev.mjpeg.MjpegSurfaceViewandroid:id="@+id/VIEW_NAME"android:layout_width="match_parent"android:layout_height="match_parent"stream:type="stream_default OR stream_native" /></RelativeLayout>

and read the stream in your activity/fragment

Mjpeg.newInstance()
 .credential("USERNAME", "PASSWORD")
 .open("IPCAM_URL.mjpg")
 .subscribe(inputStream -> {
    mjpegView.setSource(inputStream);
    mjpegView.setDisplayMode(DisplayMode.BEST_FIT);
    mjpegView.showFps(true);
 });

Solution 2:

Check the URL, I think problem with the URL. If you want to check the streaming ,you can check with your browser or VLC player which has to stream the link. I had used the same code which is perfectly streaming from the camera which is connected to the Robot

Post a Comment for "Android Mjpeg Stream"