xml - How to use VLC player to stream live feed on an IP camera with php on a Local Network -
hello guys please have xml file processed information in real-time , want use information gotten send live feed of camera on vlc people see..
below code , processed
<?php error_reporting ( e_all ); ini_set ( 'display_errors', 1 ); //timeout limit set_time_limit(0); //creating socket $socket = socket_create(af_inet, sock_stream, sol_tcp); if ($socket === false) { // echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "<br />"; } else { // echo "ok.<br />"; } //echo "attempting connect socket'..."; $result = socket_connect($socket, '192.168.43.50', 10001); flush(); if ($result === false) { // echo "socket_connect() failed.<br />reason: ($result) " . socket_strerror(socket_last_error($socket)) . "<br />"; } else { // echo "ok.<br />"; } $in = "get / http/1.1\r<br />"; $in .= "host: 132.168.43.50\r<br />"; $in .= "content-type: application/xml; encoding=utf-8\r\n"; $in .= "accept: application/xml\n"; $in .= "connection: close\r<br />\r<br />"; $out= ''; while (socket_write($socket, $in, strlen($in))){ file_put_contents("intrusion.txt",socket_read($socket, 4096)); $out = simplexml_load_string(file_get_contents("intrusion.txt",1,null,2))or die ("error: cannot create object"); //print_r ($out)."</br></br>"; //$doc = new simplexmlelement ( $out ); if (isset ( $out->devicedetectionrecord )) { /* $devname = "<strong>".$out->devicedetectionrecord->deviceidentification-> devicename."</strong>" . php_eol."</br></br>\n"; //echo "device:" . $devname;*/ $identity= "<strong>". $out->devicedetectionrecord->detection-> id ."</strong>". php_eol."</br></br>"; echo "id:" .$identity; $detect = "<strong>".$out->devicedetectionrecord->detection-> detectionevent ."</strong>". php_eol."</br></br>"; echo "detectionevent:" . $detect; $date= "<strong>".$out->devicedetectionrecord->detection-> updatetime ."</strong>". php_eol."</br></br>"; echo "updatetime:" .$date; $devicename = $out->devicedetectionrecord->deviceidentification-> devicename; $zone = explode('.', $devicename)[2]; $camip = array( 'z1' => 'https://www.youtube.com/watch?v=r7fxorx05ns', // :if port needed 'z2' => 'https://www.youtube.com/watch?v=00a4vjz7dky', 'z3' => '192.168.43.52', 'z4' => '192.168.43.53', 'z5' => '192.168.43.54', 'z6' => '192.168.43.55', 'z7' => '192.168.43.56', 'z8' => '192.168.43.57', 'z9' => '192.168.43.58', 'z10' => '192.168.43.59', 'z11' => '192.168.43.60', 'z12' => '192.168.43.61', ); if ($zone == 'z1'){ /*begin player webbot bot="htmlmarkup" startspan */ echo "<object id='mediaplayer' width='320' height='270' classid='clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95' standby='loading windows media player components...' type='application/x-oleobject' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=6,4,7,1112'>"; echo "<param name='autostart' value='true'>"; echo "<param name='filename' value=".$camip[$zone].">"; echo "<param name='showcontrols' value='false'>"; echo "<param name='showstatusbar' value='false'>"; echo "<embed type='application/x-mplayer2' src=".$camip[$zone]." name='mediaplayer' width='320' height='270' autostart='1' showcontrols='0'>"; echo "</embed>"; echo "</object>"; /*webbot bot="htmlmarkup" endspan end player */ /* echo '<script>window.open("http://$camip[$zone], "_blank", "width=400,height=500")</script>'; echo "<video '_blank' width='320' height='240' autoplay controls>"; echo "<source '_blank' src=".$camip[$zone]. "type='video/mp4'>"; echo "<object width='320' height='240' '_blank' type='application/x-shockwave-flash' data='http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf'>"; echo "<param name='movie' '_blank' value='http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf' /> "; echo "<param name='flashvars' '_blank value='config={'clip': {'url':".$camip[$zone]."',' 'autoplay':true, 'autobuffering':true}} /> "; ///<p><a href='%streamurl%">view external app</a></p> echo" </object>"; echo "</video>"; */ }elseif ($zone == 'z2'){ echo "<video target='_blank' width='320' height='240' autoplay controls>"; echo "<source target='_blank' src=".$camip[$zone]. "type='video/mp4'>"; echo "<object width='320' height='240' target='_blank' type='application/x-shockwave-flash' data='http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf'>"; echo "<param name='movie' target='_blank' value='http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf' /> "; echo "<param name='flashvars' target='_blank value='config={'clip': {'url':".$camip[$zone]."',' 'autoplay':true, 'autobuffering':true}} /> "; ///<p><a href='%streamurl%">view external app</a></p> echo" </object>"; echo "</video>"; /****** camera code function opencamfeed($zone) { $camip = array( 'z1' => 'https://www.youtube.com/watch?v=r7fxorx05ns', // :if port needed 'z2' => 'https://www.youtube.com/watch?v=00a4vjz7dky', 'z3' => '192.168.43.52', 'z4' => '192.168.43.53', 'z5' => '192.168.43.54', 'z6' => '192.168.43.55', 'z7' => '192.168.43.56', 'z8' => '192.168.43.57', 'z9' => '192.168.43.58', 'z10' => '192.168.43.59', 'z11' => '192.168.43.60', 'z12' => '192.168.43.61', ); //echo $zone.'<br /><br />'; if ($zone != '') { //header("location: http://".$camip[$zone]); echo "<video target='_blank' width='320' height='240' autoplay controls>"; echo "<source src=".$camip[$zone]. "type='video/mp4'>"; echo "<object width='320' height='240' type='application/x-shockwave-flash' data='http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf'>"; echo "<param name='movie' value='http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf' /> "; echo "<param name='flashvars' target='_blank value='config={'clip': {'url':".$camip[$zone]."',' 'autoplay':true, 'autobuffering':true}} /> "; ///<p><a href='%streamurl%">view external app</a></p> echo" </object>"; echo "</video>";/* <!--- begin player ---> <!-- webbot bot="htmlmarkup" startspan ----> <object id="mediaplayer" width="320" height="270" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" standby="loading windows media player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=6,4,7,1112"> <param name="autostart" value="true"> <param name="filename" value="rtsp://xxx.xxx.xxx:xxxx"> <param name="showcontrols" value="false"> <param name="showstatusbar" value="false"> <embed type="application/x-mplayer2" src="rtsp://xxx.xxx.xxx:xxxx" name="mediaplayer" width="320" height="270" autostart="1" showcontrols="0"></embed></object> <!-- webbot bot="htmlmarkup" endspan ----> <!--- end player ---> //echo "<iframe align='middle' height='450px' width='900px' target='_blank' src=".$camip[$zone]."></iframe>"; // } } opencamfeed($zone); **********/ } } else { print_r ($out)."</br></br>\r\n"; //echo "nothing detected" . php_eol; } flush(); ob_flush(); } socket_close($socket); ?>
Comments
Post a Comment