Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get server response once finished sending #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added example/AudioRecorderCS4-1.0.swf
Binary file not shown.
24 changes: 24 additions & 0 deletions example/acceptfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

if(!isset($_REQUEST['filename']))
{
exit('No file');
}

$upload_path = dirname(__FILE__). '/';

$filename = $_REQUEST['filename'];

$fp = fopen($upload_path."/".$filename.".wav", "wb");

fwrite($fp, file_get_contents('php://input'));

fclose($fp);


header("Content-Type: text/html");
exit('done');



?>
187 changes: 187 additions & 0 deletions example/example1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<html>
<head>

<meta name="author" content="Sajith Amma" />

<script src="jquery.min.js"> </script>
<script src="jRecorder.js"> </script>

<title>jRecorder Example</title>

<style>

li {display:inline; margin-right:10px;}
</style>


</head>


<body>







<h3>jRecorder Example 1 - Insert flash recorder inside the body tag</h3>

<p>In this example, you add a flash recorder with some call back function. $.jRecorder function is called with all initial settings.
If the second parameter for $.jRecorder is not there, plugin insert the flash recorder inside the body tag. You can specify where to insert
the flash recorder with second parameter. See <a href="example2.html">example2.html</a> for this.
</p>

<p>Download the plugin: <a href="jRecorder.zip">jRecorder.zip</a> </p>

<script>


$.jRecorder({
host : 'http://localhost/jrecorder/acceptfile.php?filename=hello.wav' , //replace with your server path please
callback_started_recording: function(){callback_started(); },
callback_stopped_recording: function(){callback_stopped(); },
callback_activityLevel: function(level){callback_activityLevel(level); },
callback_activityTime: function(time){ callback_activityTime(time); },
swf_path : 'AudioRecorderCS4-1.0.swf',
}
);



</script>


<input type="button" id="record" value="Record" style="color:red">

<input type="button" id="stop" value="Stop">



<input type="button" id="send" value="Send Data">




</body>
</html>


<script type="text/javascript">





$('#record').click(function(){


$.jRecorder.record(30);





})


$('#stop').click(function(){



$.jRecorder.stop();


})


$('#send').click(function(){



$.jRecorder.sendData();


})

function callback_finished_sending(response)
{

$('#status').html(response);

}



function callback_finished()
{

$('#status').html('Recording is finished');

}

function callback_started()
{

$('#status').html('Recording is started');

}




function callback_error(code)
{
$('#status').html('Error, code:' + code);
}


function callback_stopped()
{
$('#status').html('Stop request is accepted');
}

function callback_finished_recording()
{

$('#status').html('Recording event is finished');


}


function callback_activityLevel(level)
{

$('#level').html(level);

if(level == -1)
{
$('#levelbar').css("width", "2px");
}
else
{
$('#levelbar').css("width", (level * 2)+ "px");
}


}

function callback_activityTime(time)
{

//$('.flrecorder').css("width", "1px");
//$('.flrecorder').css("height", "1px");
$('#time').html(time);

}








</script>

Loading