feat: play video and images into calls - #201889
Open
alpersamur3 wants to merge 6 commits into
Open
alpersamur3 wants to merge 6 commits into
alpersamur3 wants to merge 6 commits into
Conversation
adds the ability to answer incoming calls, place outgoing calls and inject
audio into an active call, plus fixes that make call handling work on
current WhatsApp Web.
call:
- accept() answers a call (audio only by default, even for video calls)
- end() hangs up an ongoing call
- playAudio(media) streams a MessageMedia/base64 audio clip to the other party
- isConnected() reports whether the other party has answered
client:
- call(chatId, { video, waitForAnswer, answerTimeout }) places an outgoing call
- getActiveCall() returns the ongoing call, if any
fixes:
- Incoming "call" event: current WhatsApp Web reports calls through
WAWebCallCollection's activeCall attribute; the previous internal-map hook
no longer fires. The map hook is kept as a fallback.
- Call.reject() now goes through the voip stack, which the previous signaling
stanza no longer triggers on current WhatsApp Web.
audio is captured through a synthetic Web Audio stream, so no microphone is
required and it works headless. Adds the browser flags needed for this.
This was referenced Aug 6, 2026
whatsapp Web now asks for confirmation before any call that is not flagged as a user gesture, so startWAWebVoipCall waited on a popup and the call was never placed. Pass the same entry point and trust flag the call buttons use.
builds on the call audio injection so a call can now show a still image or
play a video clip to the other party, in a chosen frame orientation.
- Call.showImage(media) and Call.playVideo(media, { loop }) draw onto a
canvas that is fed through navigator.mediaDevices.getUserMedia, the
camera entry point WhatsApp uses (separate from the microphone one)
- Client.call and Call.accept accept orientation ('landscape', 'portrait'
or 'auto') and resolution; the orientation is fixed for the call and a
portrait frame is pre-rotated so WhatsApp displays it upright
- Call.setVideoResolution changes the resolution during a call
- Requires Google Chrome for H.264; works headless and without a camera
alpersamur3
force-pushed
the
feat/call-video-injection
branch
from
September 24, 2026 13:28
3d1efc6 to
9fc4020
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Builds on #201825 (call answering and audio injection) and adds video to calls: show a still image or play a video clip to the other party, in landscape or portrait, at a chosen resolution.
New
Callmethods:showImage(media)shows a still image to the other party for the duration of the callplayVideo(media, { loop })plays a video clip into the call; resolves when it finishes, or immediately when loopingsetVideoResolution(px)changes the outgoing video resolution mid-callNew options on
Client.call/Call.accept:orientation:'landscape'(default),'portrait', or'auto'(follows the first source). Fixed for the whole call.resolution: the short side of the frame in pixels (default 720).Injected audio (
playAudiofrom #201825) works during video calls too, so you can show video and speak at the same time.How
The outgoing camera is acquired through
navigator.mediaDevices.getUserMedia, which is patched to serve a canvas-backed stream instead of a physical camera. A draw loop paints the current source (a still image or a looping video) onto the canvas, andcanvas.captureStream()produces the outgoing frames. No camera is required and it works headless.Notes
Testing Summary
Verified live end-to-end against a real phone: showing a still image, playing a looping portrait video, injected audio playing over the video at the same time, and a mid-call resolution change. Unit tests for the call API are in
tests/call.js.