var u;function live_start(){FWRecorder.record("audio");$("#live_tips").text("\u76f4\u64ad\u4e2d\u002e\u002e\u002e");u=setTimeout("live_save()",1e4);}
function live_save(){FWRecorder.stopRecording();$("#live_tips").text("\u6b63\u5728\u53d1\u9001\u76f4\u64ad\u6d41\u002e\u002e\u002e");var fd=new FormData($("#LiveForm"));fd.append("live",FWRecorder.getBlob("audio"));var xhr=new XMLHttpRequest();xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200){live_start();if($("#textarea").val()=="[event:live]"){listenMsg.send();}}};xhr.open("POST",$("#LiveForm").attr("action"));xhr.send(fd);}
var t;var timer=0;function live_time(){clearTimeout(t);timer+=1;var count=timer;hours=Math.floor(count/3600);count-=hours*3600;minutes=Math.floor(count/60);count-=minutes*60;seconds=Math.floor(count);if(hours<10)hours="0"+hours;if(minutes<10)minutes="0"+minutes;if(seconds<10)seconds="0"+seconds;var result=hours+":"+minutes+":"+seconds;$(".taketime").text(result);t=setTimeout("live_time()",1e3);}
function live_stop(){clearTimeout(u);clearTimeout(t);$(".taketime").text("00:00:00");$("#live_progress").css({width:"0%"});$("#live_start").addClass("on").removeClass("pause");timer=0;}
$(document).ready(function(){live_stop();$("#live_tips").text("\u51c6\u5907\u5c31\u7eea");$("#live_start").click(function(){if($(this).hasClass("pause")){clearTimeout(u);clearTimeout(t);FWRecorder.stopRecording();$(this).addClass("on").removeClass("pause");$("#live_tips").text("\u5df2\u6682\u505c");}else if($(this).hasClass("on")){live_start();$(this).addClass("pause").removeClass("on");t=setTimeout("live_time()",1e3);}});$("#live_stop").click(function(){live_stop();FWRecorder.stopRecording();$("#live_tips").text("\u5df2\u7ed3\u675f");});});