hi I have a small problem i need help with i have a web page that outputs live streams in json format with links looking like this
rtmp:\/\/server:port\/camera1.stream
now if I copy and past that link into notepad and change the \/
to /
my self, the links plays fine in every media player I have and I can see the camera feed but when I use a php script to decode the json output the streams do not play at all when outputed by echo or when added to a genarated m3u8 file :
bellow is the code i use to get the page and json decode
$stream_id = $_GET["cam"];
// create curl resource
$ch = curl_init();
//set url
curl_setopt($ch, CURLOPT_URL, "http://ip:port/json");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
//close curl resource to free up system resources
curl_close($ch);
$response = json_decode($output), true);
foreach ($response['cameras'] as $result) {
if($result['name'] == $stream_id){
echo $result['cam_stream'];
}
}