Files
Testing/cam2cam.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

215 lines
6.7 KiB
PHP

<?php
/* $Id: home.php 8 2009-01-11 06:02:53Z john $ */
include "header.php";
$page = 'general';
function general()
{
global $user, $owner, $database;
?>
<?php if($_GET["id"]!=""){
?>
You are chatting with <?php echo $owner->user_info["user_username"]." ".$_GET["id"];?><?php
$chatroom=$_GET["id"];
?><br /><br />
<?php
}else{?>
This chat link is: http://bateworld.com/cam2cam.php?user=<?php echo $user->user_info["user_username"];?>&amp;id=<?php
$rand=rand();
$chatroom=$user->user_info["user_username"].$rand;
echo $chatroom;?><br /><br />
<?php }?>
<script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script language="JavaScript" src="/cam/scriptcam.js"></script>
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<style>
#webcam {
float:left;
}
#chatWindow {
width:635px;
height:75px;
overflow-y:scroll;
overflow-x:auto;
border:1px solid grey;
font-size:11px;
padding:5px;
background-color:white;
color:blue;
}
#volumeMeter {
background-image:url('/cam/ledsbg.png');
width:19px;
height:133px;
padding-top:5px;
}
#volumeMeter img {
padding-left:4px;
padding-top:1px;
display:block;
}
.ui-slider {
background:none;
background-image:url('/cam/trackslider.png');
border:0;height:107px;
margin-top:16px;
}
.ui-slider .ui-slider-handle {
width:14px;
height:32px;
margin-left:7px;
margin-bottom:-16px;
background:url('/cam/volumeslider.png') no-repeat;
}
#volumePanel {
-moz-border-radius: 0px 5px 5px 0px;
border-radius: 0px 5px 5px 0px;
background-color:#4B4B4B;
width:55px;
height:160px;
-moz-box-shadow: 0px 3px 3px #333333;
-webkit-box-shadow: 0px 3px 3px #333333;
shadow: 0px 3px 3px #333333;
}
#setupPanel {
width:650px;
height:30px;
margin:5px;
}
</style>
<script>
$r=$.noConflict();
$r(document).ready(function() {
$r("#webcam").scriptcam({
chatWindow:'chatWindow',
onError:onError,
promptWillShow:promptWillShow,
showMicrophoneErrors:false,
onWebcamReady:onWebcamReady,
connected:chatStarted,
setVolume:setVolume,
timeLeft:timeLeft,
loginName:'<?php echo $user->user_info["user_username"];?>',
chatRoom:'<?php echo $chatroom;?>'
});
setVolume(0);
$r("#slidervol").slider({ animate: true, min: 0, max: 100 , value:75, orientation: 'vertical', disabled:false});
$r("#slidervol").bind("slidechange", function(event, ui) {
$r.scriptcam.changeVolume($r("#slidervol" ).slider("option", "value"));
});
$r("#message").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
$r.scriptcam.sendMessage($r('#message').val());
$r('#message').val('');
}
});
});
function closeCamera() {
$r("#slidervol").slider("option","disabled", true);
$r.scriptcam.closeCamera();
}
function onError(errorId,errorMsg) {
alert(errorMsg+"aaa");
}
function chatStarted() {
$r("#slidervol" ).slider("option", "disabled", false);
}
function onWebcamReady(cameraNames,camera,microphoneNames,microphone,volume) {
$r("#slidervol" ).slider("option", "value", volume);
$r.each(cameraNames, function(index, text) {
$r('#cameraNames').append( $r('<option></option>').val(index).html(text))
});
$r('#cameraNames').val(camera);
$r.each(microphoneNames, function(index, text) {
$r('#microphoneNames').append( $r('<option></option>').val(index).html(text))
});
$r('#microphoneNames').val(microphone);
}
function promptWillShow() {
alert('A security dialog will be shown. Please click on ALLOW and wait for a second chat partner to arrive.');
}
function setVolume(value) {
value=parseInt(32 * value / 100) + 1;
for (var i=1; i < value; i++) {
$r('#LedBar' + i).css('visibility','visible');
}
for (i=value; i < 33; i++) {
$r('#LedBar' + i).css('visibility','hidden');
}
}
function timeLeft(value) {
$r('#timeLeft').html(value);
}
function changeCamera() {
$r.scriptcam.changeCamera($r('#cameraNames').val());
}
function changeMicrophone() {
$r.scriptcam.changeMicrophone($r('#microphoneNames').val());
}
</script>
</head>
<body>
<div id="webcam">
</div>
<div id="volumePanel" style="float:left;position:relative;top:10px;">
<div id="volumeMeter" style="position:absolute;top:10px;left:7px;float:left;">
<img id="LedBar32" src="/cam/ledred.png">
<img id="LedBar31" src="/cam/ledred.png">
<img id="LedBar30" src="/cam/ledred.png">
<img id="LedBar29" src="/cam/ledred.png">
<img id="LedBar28" src="/cam/ledred.png">
<img id="LedBar27" src="/cam/ledred.png">
<img id="LedBar26" src="/cam/ledred.png">
<img id="LedBar25" src="/cam/ledred.png">
<img id="LedBar24" src="/cam/ledred.png">
<img id="LedBar23" src="/cam/ledred.png">
<img id="LedBar22" src="/cam/ledred.png">
<img id="LedBar21" src="/cam/ledred.png">
<img id="LedBar20" src="/cam/ledgreen.png">
<img id="LedBar19" src="/cam/ledgreen.png">
<img id="LedBar18" src="/cam/ledgreen.png">
<img id="LedBar17" src="/cam/ledgreen.png">
<img id="LedBar16" src="/cam/ledgreen.png">
<img id="LedBar15" src="/cam/ledgreen.png">
<img id="LedBar14" src="/cam/ledgreen.png">
<img id="LedBar13" src="/cam/ledgreen.png">
<img id="LedBar12" src="/cam/ledgreen.png">
<img id="LedBar11" src="/cam/ledgreen.png">
<img id="LedBar10" src="/cam/ledgreen.png">
<img id="LedBar9" src="/cam/ledgreen.png">
<img id="LedBar8" src="/cam/ledgreen.png">
<img id="LedBar7" src="/cam/ledgreen.png">
<img id="LedBar6" src="/cam/ledgreen.png">
<img id="LedBar5" src="/cam/ledgreen.png">
<img id="LedBar4" src="/cam/ledgreen.png">
<img id="LedBar3" src="/cam/ledgreen.png">
<img id="LedBar2" src="/cam/ledgreen.png">
<img id="LedBar1" src="/cam/ledgreen.png">
</div>
<div id="slidervol" style="position:absolute;top:10px;left:30px; display:none;">
</div>
</div>
<br clear="both"/>
<div id="setupPanel">
<select id="cameraNames" size="1" onChange="changeCamera()" style="width:145px;font-size:10px;height:25px;">
</select>
<select id="microphoneNames" size="1" onChange="changeMicrophone()" style="width:128px;font-size:10px;height:25px;">
</select>
</div>
<div id="chatWindow"></div>
<input type="text" id="message" style="width:635px;"><?php
}
include "footer.php";
?>