diff --git a/www/lib/lib.php b/www/lib/lib.php index 1d76bf3e9..578f10eb9 100644 --- a/www/lib/lib.php +++ b/www/lib/lib.php @@ -1,7 +1,7 @@ setIPAddress($this->camera->info['ipAddr'] . ':' . $this->camera->info['onvif_port']); - $ponvif->setUsername($this->camera->info['rtsp_username']); - $ponvif->setPassword($this->camera->info['rtsp_password']); + if ($command['zoom'] == 'w') { + $zoom = '-0.1'; + } + $ponvif = new Ponvif(); + $ponvif->setIPAddress($this->camera->info['ipAddr'] . ':' . $this->camera->info['onvif_port']); + $ponvif->setUsername($this->camera->info['rtsp_username']); + $ponvif->setPassword($this->camera->info['rtsp_password']); - try { - $init = $ponvif->initialize(); - $sources = $ponvif->getSources(); + try { + $init = $ponvif->initialize(); + $sources = $ponvif->getSources(); - if (empty($sources) || $ponvif->isFault($sources)) { - // error - } else { - $profileToken = $sources[0][0]['profiletoken']; + if (empty($sources) || $ponvif->isFault($sources)) { + // error + } else { + $profileToken = $sources[0][0]['profiletoken']; - if ($pantilt_x || $pantilt_y) { - $ponvif->ptz_ContinuousMove($profileToken, $pantilt_x, $pantilt_y, $speed_pantilt_x, $speed_pantilt_y); - } + if ($pantilt_x || $pantilt_y) { + $ponvif->ptz_ContinuousMove($profileToken, $pantilt_x, $pantilt_y, $speed_pantilt_x, $speed_pantilt_y); + } - if ($zoom) { - $ponvif->ptz_ContinuousMoveZoom($profileToken, $zoom, $zoom_speed); - } - } - } catch (Exception $e) { + if ($zoom) { + $ponvif->ptz_ContinuousMoveZoom($profileToken, $zoom, $zoom_speed); + } + } + } catch (Exception $e) { } } elseif (!is_array($command) && $command == 'stop') {