Embed IP Camera streaming into website with PHP?
-
09-10-2019 - |
Question
I have done a quick google on this but i was wondering if this is possible? I have opened up ports on our router to it so its accessible from anywhere but could i use PHP or similar to grab live streaming and show it on a website somewhere?
Solution
Try this (HTML5) or just the inner object (HTML<5) with all occurences of %StreamURL%
replaced with the URL of your stream.
<video width="320" height="240" autoplay controls>
<source src="%StreamURL%" type="video/mp4">
<object width="320" height="240" type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf" />
<param name="flashvars" value='config={"clip": {"url": "%StreamURL%", "autoPlay":true, "autoBuffering":true}}' />
<p><a href="%StreamURL%">view with external app</a></p>
</object>
</video>
OTHER TIPS
You need a server to broadcast the stream for the viewers and player component that can work on desktop and mobile as well.
I have posted some info about this here on another stackowerflow topic: How can I display an RTSP video stream in a web page?
More info: http://ipcamlive.com/howdoesitwork
Please also see this to do this securely which includes live demonstrations of doing this and is free:
http://foscam.us/forum/showing-secure-methods-using-php-to-display-your-ip-cameras-t8721.html#p42139
Don