Skip to content

Example on how to connect to an ONVIF camera on Android

License

Notifications You must be signed in to change notification settings

interxis/ONVIF-Camera-Kotlin

 
 

Repository files navigation

ONVIF Camera Kotlin

Example on how to connect to an ONVIF camera on Android, and library to ease the development of an ONVIF on Kotlin MPP.

Install with Gradle (must have mavenCentral in repositories):

implementation("com.interxis.onvifcamera:1.8.2")

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)
}

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%