Ne pas executer un code.
Posté : 05 juin 2013, 09:02
Bonjour,
Alors voilà, j'ai une div dans laquelle j'ai le code pour l'affichage de ma caméra. Bon ça ça fonctionne, j'arrive à l'afficher ou la cacher avec un bouton, mais quand elle est caché, je vois que ma page charge quand même le flux, comment faire pour que cela cesse ?
<div id="camera" style="visibility:hidden;">
<!-- Affichage de la camera -->
<SCRIPT LANGUAGE="JavaScript">
// Set the BaseURL to the URL of your camera
var BaseURL = "http://192.168.1.48/"; //http://192.168.1.48/
// DisplayWidth & DisplayHeight specifies the displayed width & height of the image.
// You may change these numbers, the effect will be a stretched or a shrunk image
var DisplayWidth = "700"; //700
var DisplayHeight = "900"; //900
// This is the path to the image generating file inside the camera itself
var File = "axis-cgi/mjpg/video.cgi?resolution=1920x1080";
// No changes required below this point
var output = "";
if ((navigator.appName == "Microsoft Internet Explorer" ) &&
(navigator.platform != "MacPPC" ) && (navigator.platform != "Mac68k" ))
{
// If Internet Explorer under Windows then use ActiveX
output = '<OBJECT ID="Player" width='
output += DisplayWidth;
output += ' height=';
output += DisplayHeight;
output += ' CLASSID="CLSID:DE625294-70E6-45ED-B895-CFFA13AEB044" ';
output += 'CODEBASE="';
output += BaseURL;
output += 'activex/AMC.cab#version=3,20,18,0">';
output += '<PARAM NAME="MediaURL" VALUE="';
output += BaseURL;
output += File + '">';
output += '<param name="MediaType" value="mjpeg-unicast">';
output += '<param name="ShowStatusBar" value="1">';
output += '<param name="ShowToolbar" value="1">';
output += '<param name="AutoStart" value="1">';
output += '<param name="StretchToFit" value="1">';
output += '<BR><B>Axis Media Control</B><BR>';
output += 'The AXIS Media Control, which enables you ';
output += 'to view live image streams in Microsoft Internet';
output += ' Explorer, could not be registered on your computer.';
output += '<BR></OBJECT>';
}
else {
// If not IE for Windows use the browser itself to display
theDate = new Date();
output = '<IMG SRC="';
output += BaseURL;
output += File;
output += '&dummy=' + theDate.getTime().toString(10);
output += '" HEIGHT="';
output += DisplayHeight;
output += '" WIDTH="';
output += DisplayWidth;
output += '" ALT="Camera Image">';
}
document.write(output);
document.Player.ToolbarConfiguration = "play,+snapshot,+fullscreen"
// document.Player.UIMode = "MDConfig";
// document.Player.MotionConfigURL = "/axis-cgi/operator/param.cgi?ImageSource=0"
// document.Player.MotionDataURL = "/axis-cgi/motion/motiondata.cgi";
</SCRIPT>
</div>
[/javascript]
En gros il me faudrait autre chose que le hidden... Un truc plus costaud, plus violant :p
Merci d'avance
Alors voilà, j'ai une div dans laquelle j'ai le code pour l'affichage de ma caméra. Bon ça ça fonctionne, j'arrive à l'afficher ou la cacher avec un bouton, mais quand elle est caché, je vois que ma page charge quand même le flux, comment faire pour que cela cesse ?
$("#BoutonCam").click(function(){
if(passé == false){
passé = true;
document.getElementById("camera").style.visibility="visible";
document.getElementById("BoutonCam").value="Cacher la vidéo";
}
else{
passé = false;
document.getElementById("camera").style.visibility="hidden";
document.getElementById("BoutonCam").value="Afficher la vidéo";
}
});
[javascript]<div id="camera" style="visibility:hidden;">
<!-- Affichage de la camera -->
<SCRIPT LANGUAGE="JavaScript">
// Set the BaseURL to the URL of your camera
var BaseURL = "http://192.168.1.48/"; //http://192.168.1.48/
// DisplayWidth & DisplayHeight specifies the displayed width & height of the image.
// You may change these numbers, the effect will be a stretched or a shrunk image
var DisplayWidth = "700"; //700
var DisplayHeight = "900"; //900
// This is the path to the image generating file inside the camera itself
var File = "axis-cgi/mjpg/video.cgi?resolution=1920x1080";
// No changes required below this point
var output = "";
if ((navigator.appName == "Microsoft Internet Explorer" ) &&
(navigator.platform != "MacPPC" ) && (navigator.platform != "Mac68k" ))
{
// If Internet Explorer under Windows then use ActiveX
output = '<OBJECT ID="Player" width='
output += DisplayWidth;
output += ' height=';
output += DisplayHeight;
output += ' CLASSID="CLSID:DE625294-70E6-45ED-B895-CFFA13AEB044" ';
output += 'CODEBASE="';
output += BaseURL;
output += 'activex/AMC.cab#version=3,20,18,0">';
output += '<PARAM NAME="MediaURL" VALUE="';
output += BaseURL;
output += File + '">';
output += '<param name="MediaType" value="mjpeg-unicast">';
output += '<param name="ShowStatusBar" value="1">';
output += '<param name="ShowToolbar" value="1">';
output += '<param name="AutoStart" value="1">';
output += '<param name="StretchToFit" value="1">';
output += '<BR><B>Axis Media Control</B><BR>';
output += 'The AXIS Media Control, which enables you ';
output += 'to view live image streams in Microsoft Internet';
output += ' Explorer, could not be registered on your computer.';
output += '<BR></OBJECT>';
}
else {
// If not IE for Windows use the browser itself to display
theDate = new Date();
output = '<IMG SRC="';
output += BaseURL;
output += File;
output += '&dummy=' + theDate.getTime().toString(10);
output += '" HEIGHT="';
output += DisplayHeight;
output += '" WIDTH="';
output += DisplayWidth;
output += '" ALT="Camera Image">';
}
document.write(output);
document.Player.ToolbarConfiguration = "play,+snapshot,+fullscreen"
// document.Player.UIMode = "MDConfig";
// document.Player.MotionConfigURL = "/axis-cgi/operator/param.cgi?ImageSource=0"
// document.Player.MotionDataURL = "/axis-cgi/motion/motiondata.cgi";
</SCRIPT>
</div>
[/javascript]
En gros il me faudrait autre chose que le hidden... Un truc plus costaud, plus violant :p
Merci d'avance