I am unable to figure out the syntax to stream a video from Tapo c200 onto my webpage. I have the php code successfully working on both my PC and raspberry pi using Apache server which streams the raspberry pi camera running on MJPEG- streamer.
**Success **
My raspberry pi camera is congfigured as an IP camera using MJPEG-streamer application.It is defined on the wifi network as:
http://192.168.1.129:8080/?action=stream
The following fsockopen script reaches this camera successfully with the following php code and displays it on my webpage through the "src = calling below script" inside a html <img ....>
<?php
$server = "192.168.1.129"; // camera server address
$port = 8080; // camera server port
$url = "/?action=stream"; // image url on server
set_time_limit(0);
$fp = fsockopen($server, $port, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n"; // error handling
} else {
$urlstring = "GET ".$url." HTTP/1.0\r\n\r\n";
fputs ($fp, $urlstring);
while ($str = trim(fgets($fp, 4096)))
header($str);
fpassthru($fp);
fclose($fp);
}
?>
Failure
I have checked the documentation for the Tapo camera, and to call it , an id and a pw is needed which I set also on the camera settings in the app
to access this camera, I found the following syntax:-
1920x1080:rtsp://administrator:[email protected]:554/stream1
but I just cant seem to figure out how to make the fsockopen code to work. Here is my feeble attempt
<?php
$server = "192.168.1.181"; // camera server address
$port = 8090; // camera server port
$url = "1920x1080:rtsp://administrator:[email protected]:554/stream1";
set_time_limit(0);
$fp = fsockopen($server, $port, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n"; // error handling
} else {
$urlstring = "GET ".$url." HTTP/1.0\r\n\r\n";
fputs ($fp, $urlstring);
while ($str = trim(fgets($fp, 4096)))
header($str);
fpassthru($fp);
fclose($fp);
}
?>