Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.HonzaR:android-mjpeg-view:v1.0.4'
}
dependencies {
implementation("com.github.HonzaR:android-mjpeg-view:v1.0.4")
}
<dependency>
<groupId>com.github.HonzaR</groupId>
<artifactId>android-mjpeg-view</artifactId>
<version>v1.0.4</version>
</dependency>
libraryDependencies += "com.github.HonzaR" % "android-mjpeg-view" % "v1.0.4"
:dependencies [[com.github.HonzaR/android-mjpeg-view "v1.0.4"]]
Android custom View for displaying MJPEG.<br/> This view only required a specific http url.<br/> Image scaling method can be specificed--fit width, fit height, original size, stretch and best fit.<br/> Only boundary is used to separate each jpeg image (frame) from stream. Content-length is ignored.<br/>
You can download .arr at https://github.com/perthcpe23/android-mjpeg-view/tree/master/arr
Basic usage<br/> XML layout source code:
<com.longdo.mjpegviewer.MjpegView
android:id="@+id/mjpegview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Java source code:
MjpegView viewer = (MjpegView) findViewById(R.id.mjpegview);
viewer.setMode(MjpegView.MODE_FIT_WIDTH);
viewer.setAdjustHeight(true);
viewer.setUrl("http://www.example.com/mjpeg.php?id=1234");
viewer.startStream();
//when user leaves application
viewer.stopStream();
This project has been developed using Android Studio.
Contributions by Longdo Developer Team (http://www.longdo.com)