Skip to content

sproctor/ONVIF-Camera-Kotlin

 
 

Repository files navigation

ONVIF Camera Kotlin

Kotlin MPP implementation of ONVIF discovery for cameras on Android and JVM.

Install with Gradle (must have mavenCentral in repositories):

implementation("com.seanproctor:onvifcamera:<VERSION>")

Connect to an Onvif camera and information

val device = OnvifDevice.requestDevice("IP_ADDRESS:PORT", "login", "pwd")
val deviceInfo = device.getDeviceInformation()

Retrieve the stream URI

val device = OnvifDevice.requestDevice("IP_ADDRESS:PORT", "login", "pwd")

// Get media profiles to find which ones are streams/snapshots
val profiles = device.getProfiles()

val streamUri = profiles.firstOrNull { it.canStream() }?.let {
    device.getStreamURI(it, addCredentials = true)
}
val snapshotUri = profiles.firstOrNull { it.canSnapshot() }?.let { 
    device.getSnapshotURI(it)
}

References

http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl

About

Example on how to connect to an ONVIF camera on Android

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 100.0%