Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface WebRtcBridge
Internal service-provider interface a port implements to carry the
com.codename1.webrtc API onto its native WebRTC stack: Google’s
org.webrtc on Android, the WebRTC framework on iOS, the browser’s
RTCPeerConnection in the JavaScript port, and a loopback in the
simulator.
Application code never touches this interface; the public classes reach it
through com.codename1.ui.Display#getWebRtcBridge(), and a port that
returns null there is a port without WebRTC – WebRtc.isSupported()
says so and nothing else needs a platform if.
Everything is ids, primitives and strings
As with com.codename1.call.spi.CallBridge, no method takes or returns a
framework type, so a port reached through ParparVM never constructs a
Java object from native code. Peer connections and tracks are integer
handles the port allocates; structured values cross as strings.
Every request answers exactly once
An operation that can fail takes a requestId from the caller and answers
it by calling exactly one of WebRtc.deliverDescription,
WebRtc.deliverTracks or WebRtc.deliverResult. A request that never
answers leaves an AsyncResource that never settles, which is worse than
one that fails. Unsolicited events – a gathered candidate, a state
change, a remote track – carry the peer handle instead. Every entry point
may be called from any thread; they marshal to the EDT themselves.
Methods
Method details
createPeerConnection
public abstract int createPeerConnection(String iceServers, boolean relayOnly)Parameters
iceServersString- one server per line, each line tab-separated as
urls(comma-separated),username,credential relayOnlyboolean- whether only relayed (TURN) candidates may be used, which keeps the device’s own addresses from the other side
openUserMedia
public abstract void openUserMedia(int requestId, boolean audio, boolean video, boolean frontCamera)WebRtc.deliverTracks: the handles of the audio track and the video
track, 0 for one not asked for.addTrack
public abstract void addTrack(int peer, int track)createDescription
public abstract void createDescription(int peer, int requestId, boolean answer)answer an answer to the remote description
already set. Answers with WebRtc.deliverDescription.setDescription
public abstract void setDescription(int peer, int requestId, boolean remote, String type, String sdp)remote as the remote
one. Answers with WebRtc.deliverResult.Parameters
peerint- Not documented.
requestIdint- Not documented.
remoteboolean- Not documented.
typeStringofferoranswersdpString- Not documented.
addIceCandidate
public abstract void addIceCandidate(int peer, String sdpMid, int sdpMLineIndex, String candidate)closePeerConnection
public abstract void closePeerConnection(int peer)setTrackEnabled
public abstract void setTrackEnabled(int track, boolean enabled)switchCamera
public abstract void switchCamera(int track)setSpeakerphone
public abstract void setSpeakerphone(boolean on)releaseTrack
public abstract void releaseTrack(int track)createVideoView
public abstract Object createVideoView(int track, boolean mirror)com.codename1.ui.PeerComponent,
or any com.codename1.ui.Component on a port that draws it itself.
Null when the track cannot be drawn.releaseVideoView
public abstract void releaseVideoView(Object view)