Voice Chat from MultiPlayer3D.com.
Instructions: click the Voice chat button ("VC Start") once in the Unity Player above to start recording your message. Then click again to stop recording and send the message. -Doug 6/15/2009.
6/28/2009: Added "v" key toggle for voice chat. Press and hold v key to record, release v key to send. - Doug
Unity Code
private var voiceChatButtonText = "VC Start";
private var voiceChatStatus = 0;
var skin : GUISkin;
function OnGUI ()
{
//6/28/2009 DmT: Modifying for voice chat applet
GUI.skin = skin;
if(GUILayout.Button(voiceChatButtonText))
{
if(voiceChatStatus == 0){
voiceChatStatus = 1;
voiceChatButtonText = "VC Recording";
Application.ExternalCall("document.VoiceChat6.startCapture");
} else if(voiceChatStatus == 1){
voiceChatStatus = 0;
voiceChatButtonText = "VC Sent, Ready";
Application.ExternalCall("document.VoiceChat6.stopCapture");
} else {
voiceChatStatus = 0;
}
}
}
function Update () {
if (Input.GetKeyDown("v"))
{
if(voiceChatStatus == 0){
voiceChatStatus = 1;
voiceChatButtonText = "VC Recording";
Application.ExternalCall("document.VoiceChat6.startCapture");
}
}
if(Input.GetKeyUp("v")){
if(voiceChatStatus == 1){
voiceChatStatus = 0;
voiceChatButtonText = "VC Sent, Ready";
Application.ExternalCall("document.VoiceChat6.stopCapture");
}
}
}
Note: "VoiceChat6" above is the name of the Java Voice Chat Applet on the webpage.
Send feedback to doug@multiplayer3d.com