当前位置:网站首页>Development and code analysis of easycvr national standard user defined streaming address function

Development and code analysis of easycvr national standard user defined streaming address function

2022-06-23 20:41:00 Tsingsee green rhino video

Security video cloud service platform EasyCVR As a mature and stable video distribution platform , There is no need to adjust the existing monitoring architecture , Support CDN Push flow , Flexible to adapt to the original architecture ; And flexible expansion on demand 、 Shrinking resources , No plug-in installation 、 Browser restrictions, etc , No plug-ins are implemented 、 Multi platform free viewing playback .

At some user sites , Appear in the EasyCVR There are different network segments in the devices connected to the , So we need to add a new feature , I.e. customized collection address , Distinguish the collection addresses of different devices .

Functional analysis , You need to edit the device , Provide interface for the front end , Then collect the incoming stream from the front end ip Record in the database , When the user plays , Find out , To the device .

Add the following code , First, add fields to the database , Record the device stream collection information during initialization . Then play and return .

q := db.SQLite.Model(models.Device{}).Where("`index`=?", device.DeviceID)
q.Find(&gbsdevs)
if len(gbsdevs) != 1 {
       err = fmt.Errorf("device[%d] not found", device.DeviceID)
       return
}
//[ transmission mode ]
gbsdevs[0].MediaTransport = device.Transport
//[ Enable ]
gbsdevs[0].Enable = device.Enable
db.SQLite.Model(models.Device{}).Save(gbsdevs[0])
//
sipDev := uas.Server.GetDevice(gbsdevs[0].ID)
if sipDev == nil {
       err = fmt.Errorf("device[%s] not found", gbsdevs[0].ID)
       return
}

gbschns := make([]*models.Channel, 0)

After editing at the front end again , Then the back end plays , The custom stream address configuration takes effect .

原网站

版权声明
本文为[Tsingsee green rhino video]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/12/202112291744197726.html