Perpustakaan mengimplementasikan protokol UDP Cloud port 32100 yang digunakan oleh banyak kamera P2P. Anda dapat menemukan deskripsi protokol di wiki
npm install --save lib32100
Membutuhkan Perpustakaan
const lib32100 = require ( 'lib32100' )
Buat instance klien
const client = lib32100 . client ( )
Perhatikan bahwa setiap klien dapat menangani satu perangkat (kamera) dan beberapa server cloud .
Tambahkan server
client . addServer ( { host : "myserver.example.com" , port : 32100 } )
Atur UID perangkat
client . setUid ( 'PROD123456ABCDE' )
Tambahkan pendengar
client . on ( 'stun' , ( e ) => console . log ( JSON . stringify ( e ) ) )
client . on ( 'lookup' , ( e ) => console . log ( JSON . stringify ( e ) ) )
Kirim perintah ke server Cloud
client . sendSTUNRequest ( )
client . lookupUid ( )
Tambahkan alamat kamera
client . addCamAddress ( { host : "192.168.0.100" , port : 10088 } )
Tetapkan kredensial kamera
client . setCamCredentials ( { user : 'admin' , pass : 'password' } )
Buka sesi kamera langsung
client . openDirectCamSession ( { host : "192.168.0.100" , port : 10088 } )
Periksa kredensial
client . checkCredentials ( )
Dapatkan cuplikan
client . getSnapshot ( )
Kirim permintaan GET khusus
client . sendGet ( '/custom_url.cgi?myparam=hello' )
Kirim beberapa permintaan GET
client . sendMultipleGet ( [ '/custom_url1.cgi' , '/custom_url2.cgi' , '/custom_url3.cgi' ] )
Dapatkan streaming video langsung
client . getVideoStream ( )
Dapatkan streaming audio langsung
client . getAudioStream ( )
Hentikan streaming video
client . stopVideoStream ( )
Hentikan aliran audio
client . stopAudioStream ( )
Dapatkan berbagai informasi
client . getParams ( )
client . getCameraParams ( )
client . getFactoryParam ( )
client . getStatus ( )
client . cameraControl ( )
client . getMisc ( )
client . login ( )
client . getRtsp ( )
client . getOnvif ( )
client . getRecord ( )
client . wifiScan ( )
client . getWifiScanResult ( )
Bergerak ke arah dalam beberapa langkah
client . stepDown ( )
client . stepLeft ( )
client . stepRight ( )
client . stepUp ( )
Bergerak ke arah
client . moveDown ( )
client . moveLeft ( )
client . moveRight ( )
client . moveUp ( )
client . stopMove ( )
Tutup sesi
client . closeCamSession ( )
Anda dapat mendengarkan pada acara-acara berikut:
stun (server response)
lookup (server response)
lookupACK (server response)
unknownMsg (any message not yet parsable by the library)
pingpong (camera ping or pong)
close (camera closed session)
confirmed (camera comfirmed ID i.e. session opened)
ack (camera acked a message)
http (an http response)
audio (live audio data)
video (live video data)
complete (a complete http response)
lostConnection (the connection was lost)
Implementasi ini tidak didasarkan pada spesifikasi resmi tetapi murni pada rekayasa balik protokol. Saya tidak dapat menjamin ini akan berfungsi di semua perangkat.
MIT. Hak Cipta (c) Fabrizio Bertone