4.1.9. createAnswer
4.1.9. createAnswer
The createAnswer method generates a blob of SDP that contains an SDP answer per [RFC3264] with the supported configuration for the session that is compatible with the parameters supplied in the most recent call to setRemoteDescription; setRemoteDescription MUST have been called prior to calling createAnswer. Like createOffer, the returned blob contains descriptions of the media added to this PeerConnection, the codec/RTP/RTCP options negotiated for this session, and any candidates that have been gathered by the ICE agent. An options parameter may be supplied to provide additional control over the generated answer.
As an answer, the generated SDP will contain a specific configuration that specifies how the media plane should be established; for each SDP line, the generation of the SDP MUST follow the process defined for generating an answer from the specification that defines the given SDP line. The exact handling of answer generation is detailed in Section 5.3 below.
Session descriptions generated by createAnswer MUST be immediately usable by setLocalDescription; like createOffer, the returned description SHOULD reflect the current state of the system.
Calling this method may do things such as generating new ICE credentials, but it does not change the PeerConnection state, trigger candidate gathering, or cause a media state change. Specifically, the answer is not applied, and does not become the current local description, until setLocalDescription is called.