Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/config_sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@
# - These are show on the beamline status and active datacollection lists
$webcams = array('i03' => array('1.2.3.4'),
);
# Allow overriding of default resolution (480x270) and fps (5) or any other URL parameters
$webcamParameters = array(
'1.2.3.4' => array(
'resolution' => '480x360',
'fps' => 1,
),
);

# On-axis viewing (OAV) camera addresses
# - Shown on beamline status page for staff, for remote debugging
Expand Down
13 changes: 11 additions & 2 deletions api/src/Page/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function _forward_oav() {
# ------------------------------------------------------------------------
# Forward beamline webcams
function _forward_webcam() {
global $webcams;
global $webcams, $webcamParameters;

if (!array_key_exists($this->arg('bl'), $webcams)) return;

Expand All @@ -327,9 +327,18 @@ function _forward_webcam() {

while (@ob_end_clean());
header('content-type: multipart/x-mixed-replace; boundary=myboundary');

$params = array(
'fps' => 5,
'resolution' => '480x270',
);
if (isset($webcamParameters[$img])) {
$params = array_merge($params, $webcamParameters[$img]);
}
$url = 'http://' . $img . '/axis-cgi/mjpg/video.cgi?' . http_build_query($params);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://'.$img.'/axis-cgi/mjpg/video.cgi?fps=5&resolution=CIF&resolution=480x270');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
$im = curl_exec($ch);
Expand Down
Loading