In the following script the url of some video source are gotten from a json and played on a web interface.
The urls are like this: http://ip:port/resource?user=blabla&pwd=blablabla when the page is loaded in the firefox console i find:
GET http://ip:port/resource
the question mark and all following chars are omitted.
So the device do not receive the well formed url and the streaming do not starts.
function getData(){
var deviceParams = {};
$.ajax({
url: "cameras.json",
//dataType: 'json',
dataType: 'json',
success: function(data) {
/* Dinamically adding cams div */
var camsList = $("#cams_ul");
var availableCams = formatDeviceParams(data.deviceParams);
var videoSrc = "";
availableCams.forEach(function(cam, index){
videoSrc = "http://" + cam.ip + ":" + cam.port + cam.video_url;
camsList.append('<div class="panel-video panel panel-primary col-md-3 col-xs-5 col-xxs-10">'
+cam.device_name+
'<div class="panel-body"><img class="videovid" src="'+videoSrc+'"/></div></div>');
});
/* ======= jQuery Modal section ======= */
var images = document.getElementsByClassName('videodiv');
for (var i = 0; i < images.length; i++) {
images[i].onclick = function(){
openNav();
$("#modal-image").attr("src", this.src);
}
}
/* ====== END Modal section ===== */
}
});
}