as the title suggests.. is it possible? we are planning to make an application that just uses AJAX to make Voice Calls as seen in Meebo.com. They've developed an application that uses flash with voice chat.. Is it possible using Javascript alone?

Dani AI

Generated

Short answer: not with AJAX alone. As hinted, AJAX (XHR/fetch) is a request/response mechanism and cannot capture or stream low-latency microphone audio. Modern browsers provide WebRTC for in-browser voice (and video): getUserMedia to access the microphone and RTCPeerConnection to stream audio peer-to-peer without plugins. See getUserMedia and RTCPeerConnection.

Typical architecture: capture audio -> create an RTCPeerConnection -> exchange SDP offers/answers and ICE candidates over a signaling channel (this signaling can be AJAX requests, but WebSockets are usually better for real-time) -> direct RTP/DTLS/SRTP media between peers. STUN/TURN servers are needed for NAT traversal. For a high-level overview see webrtc.org and the WebSocket API.

Minimal flow example:

const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
const pc = new RTCPeerConnection({ iceServers: [{ urls: "stun:stun.l.google.com:19302" }] });
stream.getTracks().forEach(track => pc.addTrack(track, stream));
const offer = await pc.createOffer();
await pc.setLocalDescription(offer);
// send offer.sdp to the remote peer via the signaling channel (WebSocket/AJAX)

Practical notes: getUserMedia requires HTTPS (except localhost); test across Chrome/Firefox/Edge/Safari; TURN servers may be required on restrictive networks and can incur cost; group calls usually need an SFU (Jitsi/Janus/mediasoup) or a hosted provider (Twilio/Agora) for scaling. Libraries such as simple-peer or PeerJS simplify signaling and connection handling. Historical Flash-based solutions (mentioned by ) are now obsolete.

Recommended Answers

All 2 Replies

Not alone with ajax.

Not alone with ajax.

yup, you're right. I was just looking for possibilities. I guess we're still on stone age but I know it is possible with flash though. Thanks for your reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.