Categorygithub.com/pions/webrtc
modulepackage
1.2.0
Repository: https://github.com/pions/webrtc.git
Documentation: pkg.go.dev

# README

Pion WebRTC
Pion WebRTC

A pure Go implementation of the WebRTC API

Pion webrtc Sourcegraph Widget Slack Widget Waffle board
Build Status GoDoc Coverage Status Go Report Card Codacy Badge License: MIT


See DESIGN.md for an overview of features and future goals.

Usage

Check out the example applications to help you along your Pion WebRTC journey.

The Pion WebRTC API closely matches the JavaScript WebRTC API. Most existing documentation is therefore also usefull when working with Pion. Furthermore, our GoDoc is actively maintained.

Now go forth and build some awesome apps! Here are some ideas to get your creative juices flowing:

  • Send a video file to multiple browser in real time for perfectly synchronized movie watching.
  • Send a webcam on an embedded device to your browser with no additional server required!
  • Securely send data between two servers, without using pub/sub.
  • Record your webcam and do special effects server side.
  • Build a conferencing application that processes audio/video and make decisions off of it.

Roadmap

The library is in active development, please refer to the roadmap to track our major milestones.

Community

Pion has an active community on the Golang Slack. Sign up and join the #pion channel for discussions and support. You can also use Pion mailing list.

We are always looking to support your projects. Please reach out if you have something to build!

If you need commercial support or don't want to use public methods you can contact us at [email protected]

Related projects

  • pions/turn: A simple extendable Golang TURN server
  • [WIP] pions/media-server: A Pion WebRTC powered media server, providing the building blocks for anything RTC.
  • [WIP] pions/dcnet: A package providing Golang net interfaces around Pion WebRTC data channels.

Contributing

Check out the contributing wiki to join the group of amazing people making this project possible:

License

MIT License - see LICENSE for full text

# Packages

No description provided by the author
No description provided by the author

# Functions

GenerateCertificate causes the creation of an X.509 certificate and corresponding private key.
New creates a new RTCPeerConfiguration with the provided configuration.
NewMediaEngine creates a new MediaEngine.
NewRTCCertificate generates a new x509 compliant RTCCertificate to be used by DTLS for encrypting data sent over the wire.
NewRTCRtpCodec is used to define a new codec.
NewRTCRtpG722Codec is a helper to create a G722 codec.
NewRTCRtpH264Codec is a helper to create an H264 codec.
NewRTCRtpOpusCodec is a helper to create an Opus codec.
NewRTCRtpTransceiverDirection defines a procedure for creating a new RTCRtpTransceiverDirection from a raw string naming the transceiver direction.
NewRTCRtpVP8Codec is a helper to create an VP8 codec.
NewRTCRtpVP9Codec is a helper to create an VP9 codec.
RegisterCodec is used to register a codec with the DefaultMediaEngine.
RegisterDefaultCodecs is a helper that registers the default codecs supported by pions-webrtc.

# Constants

PayloadTypes for the default codecs.
PayloadTypes for the default codecs.
PayloadTypes for the default codecs.
PayloadTypes for the default codecs.
PayloadTypes for the default codecs.
Names for the default codecs supported by pions-webrtc.
Names for the default codecs supported by pions-webrtc.
Names for the default codecs supported by pions-webrtc.
RTCBundlePolicyBalanced indicates to gather ICE candidates for each media type in use (audio, video, and data).
RTCBundlePolicyMaxBundle indicates to gather ICE candidates for only one track.
RTCBundlePolicyMaxCompat indicates to gather ICE candidates for each track.
RTCDataChannelStateClosed indicates that the underlying data transport has been closed or could not be established.
RTCDataChannelStateClosing indicates that the procedure to close down the underlying data transport has started.
RTCDataChannelStateConnecting indicates that the data channel is being established.
RTCDataChannelStateOpen indicates that the underlying data transport is established and communication is possible.
RTCDtlsTransportStateClosed indicates that the transport has been closed intentionally as the result of receipt of a close_notify alert, or calling close().
RTCDtlsTransportStateConnected indicates that DTLS has completed negotiation of a secure connection and verified the remote fingerprint.
RTCDtlsTransportStateConnecting indicates that DTLS is in the process of negotiating a secure connection and verifying the remote fingerprint.
RTCDtlsTransportStateFailed indicates that the transport has failed as the result of an error (such as receipt of an error alert or failure to validate the remote fingerprint).
RTCDtlsTransportStateNew indicates that DTLS has not started negotiating yet.
RTCIceCandidateTypeHost indicates that the candidate is of Host type as described in https://tools.ietf.org/html/rfc8445#section-5.1.1.1.
RTCIceCandidateTypePrflx indicates that the candidate is of Peer Reflexive type.
RTCIceCandidateTypeRelay indicates the the candidate is of Relay type as described in https://tools.ietf.org/html/rfc8445#section-5.1.1.2.
RTCIceCandidateTypeSrflx indicates the the candidate is of Server Reflexive type as described https://tools.ietf.org/html/rfc8445#section-5.1.1.2.
RTCIceComponentRtcp indicates that the ICE Transport is used for RTCP as defined by https://tools.ietf.org/html/rfc5245#section-4.1.1.1.
RTCIceComponentRtp indicates that the ICE Transport is used for RTP (or RTCP multiplexing), as defined in https://tools.ietf.org/html/rfc5245#section-4.1.1.1.
RTCIceConnectionStateChecking indicates that any of the RTCIceTransports are in the "checking" state and none of them are in the "disconnected" or "failed" state.
RTCIceConnectionStateClosed indicates that the RTCPeerConnection's isClosed is true.
RTCIceConnectionStateCompleted indicates that all RTCIceTransports are in the "completed" or "closed" state and at least one of them is in the "completed" state.
RTCIceConnectionStateConnected indicates that all RTCIceTransports are in the "connected", "completed" or "closed" state and at least one of them is in the "connected" state.
RTCIceConnectionStateDisconnected indicates that any of the RTCIceTransports are in the "disconnected" state and none of them are in the "failed" state.
RTCIceConnectionStateFailed indicates that any of the RTCIceTransports are in the "failed" state.
RTCIceConnectionStateNew indicates that any of the RTCIceTransports are in the "new" state and none of them are in the "checking", "disconnected" or "failed" state, or all RTCIceTransports are in the "closed" state, or there are no transports.
RTCIceCredentialTypeOauth describes token based credential as described in https://tools.ietf.org/html/rfc7635.
RTCIceCredentialTypePassword describes username and pasword based credentials as described in https://tools.ietf.org/html/rfc5389.
RTCIceGatheringStateComplete indicates that at least one RTCIceTransport exists, and all RTCIceTransports are in the "completed" gathering state.
RTCIceGatheringStateGathering indicates that any of the RTCIceTransports are in the "gathering" state.
RTCIceGatheringStateNew indicates that any of the RTCIceTransports are in the "new" gathering state and none of the transports are in the "gathering" state, or there are no transports.
RTCIceProtocolTCP indicates the URL uses a TCP transport.
RTCIceProtocolUDP indicates the URL uses a UDP transport.
RTCIceRoleControlled indicates that an ICE agent that waits for the controlling agent to select the final choice of candidate pairs.
RTCIceRoleControlling indicates that the ICE agent that is responsible for selecting the final choice of candidate pairs and signaling them through STUN and an updated offer, if needed.
RTCIceTransportPolicyAll indicates any type of candidate is used.
RTCIceTransportPolicyRelay indicates only media relay candidates such as candidates passing through a TURN server are used.
RTCPeerConnectionStateClosed indicates the peer connection is closed and the isClosed member variable of RTCPeerConnection is true.
RTCPeerConnectionStateConnected indicates that all RTCIceTransports and RTCDtlsTransports are in the "connected", "completed" or "closed" state and at least one of them is in the "connected" or "completed" state.
RTCPeerConnectionStateConnecting indicates that any of the RTCIceTransports or RTCDtlsTransports are in the "connecting" or "checking" state and none of them is in the "failed" state.
RTCPeerConnectionStateDisconnected indicates that any of the RTCIceTransports or RTCDtlsTransports are in the "disconnected" state and none of them are in the "failed" or "connecting" or "checking" state.
RTCPeerConnectionStateFailed indicates that any of the RTCIceTransports or RTCDtlsTransports are in a "failed" state.
RTCPeerConnectionStateNew indicates that any of the RTCIceTransports or RTCDtlsTransports are in the "new" state and none of the transports are in the "connecting", "checking", "failed" or "disconnected" state, or all transports are in the "closed" state, or there are no transports.
RTCPriorityTypeHigh corresponds to "extra high".
RTCPriorityTypeLow corresponds to "normal".
RTCPriorityTypeMedium corresponds to "high".
RTCPriorityTypeVeryLow corresponds to "below normal".
RTCRtcpMuxPolicyNegotiate indicates to gather ICE candidates for both RTP and RTCP candidates.
RTCRtcpMuxPolicyRequire indicates to gather ICE candidates only for RTP and multiplex RTCP on the RTP candidates.
RTCRtpCodecTypeAudio indicates this is an audio codec.
RTCRtpCodecTypeVideo indicates this is a video codec.
RTCRtpTransceiverDirectionInactive indicates the RTCRtpSender won't offer to send RTP and RTCRtpReceiver the won't offer to receive RTP.
RTCRtpTransceiverDirectionRecvonly indicates the RTCRtpReceiver the will offer to receive RTP.
RTCRtpTransceiverDirectionSendonly indicates the RTCRtpSender will offer to send RTP.
RTCRtpTransceiverDirectionSendrecv indicates the RTCRtpSender will offer to send RTP and RTCRtpReceiver the will offer to receive RTP.
RTCSctpTransportStateClosed indicates a SHUTDOWN or ABORT chunk is received or when the SCTP association has been closed intentionally, such as by closing the peer connection or applying a remote description that rejects data or changes the SCTP port.
RTCSctpTransportStateConnected indicates the negotiation of an association is completed.
RTCSctpTransportStateConnecting indicates the RTCSctpTransport is in the process of negotiating an association.
RTCSdpTypeAnswer indicates that a description MUST be treated as an SDP final answer, and the offer-answer exchange MUST be considered complete.
RTCSdpTypeOffer indicates that a description MUST be treated as an SDP offer.
RTCSdpTypePranswer indicates that a description MUST be treated as an SDP answer, but not a final answer.
RTCSdpTypeRollback indicates that a description MUST be treated as canceling the current SDP negotiation and moving the SDP offer and answer back to what it was in the previous stable state.
RTCSignalingStateClosed indicates The RTCPeerConnection has been closed.
RTCSignalingStateHaveLocalOffer indicates that a local description, of type "offer", has been successfully applied.
RTCSignalingStateHaveLocalPranswer indicates that a remote description of type "offer" has been successfully applied and a local description of type "pranswer" has been successfully applied.
RTCSignalingStateHaveRemoteOffer indicates that a remote description, of type "offer", has been successfully applied.
RTCSignalingStateHaveRemotePranswer indicates that a local description of type "offer" has been successfully applied and a remote description of type "pranswer" has been successfully applied.
RTCSignalingStateStable indicates there is no offer/answer exchange in progress.
Unknown defines default public constant to use for "enum" like struct comparisons when no value was defined.
Names for the default codecs supported by pions-webrtc.
Names for the default codecs supported by pions-webrtc.

# Variables

DefaultMediaEngine is the default MediaEngine used by RTCPeerConnections.
ErrCertificateExpired indicates that an x509 certificate has expired.
ErrConnectionClosed indicates an operation executed after connection has already been closed.
ErrExistingTrack indicates that a track already exists.
ErrMaxDataChannelID indicates that the maximum number ID that could be specified for a data channel has been exceeded.
ErrModifyingBundlePolicy indicates that an attempt to modify BundlePolicy was made after RTCPeerConnection has been initialized.
ErrModifyingCertificates indicates that an attempt to modify Certificates was made after RTCPeerConnection has been initialized.
ErrModifyingIceCandidatePoolSize indicates that an attempt to modify IceCandidatePoolSize was made after RTCPeerConnection has been initialized.
ErrModifyingPeerIdentity indicates that an attempt to modify PeerIdentity was made after RTCPeerConnection has been initialized.
ErrModifyingRtcpMuxPolicy indicates that an attempt to modify RtcpMuxPolicy was made after RTCPeerConnection has been initialized.
ErrNegotiatedWithoutID indicates that an attempt to create a data channel was made while setting the negotiated option to true without providing the negotiated channel ID.
ErrNoTurnCredencials indicates that a TURN server URL was provided without required credentials.
ErrPrivateKeyType indicates that a particular private key encryption chosen to generate a certificate is not supported.
ErrRetransmitsOrPacketLifeTime indicates that an attempt to create a data channel was made with both options MaxPacketLifeTime and MaxRetransmits set together.
ErrStringSizeLimit indicates that the character size limit of string is exceeded.
ErrTurnCredencials indicates that provided TURN credentials are partial or malformed.
ErrUnknownType indicates an error with Unknown info.

# Structs

MediaEngine defines the codecs supported by a RTCPeerConnection.
RTCAnswerOptions structure describes the options used to control the answer creation process.
RTCCertificate represents a x509Cert used to authenticate WebRTC communications.
RTCConfiguration defines a set of parameters to configure how the peer-to-peer communication via RTCPeerConnection is established or re-established.
RTCDataChannel represents a WebRTC DataChannel The RTCDataChannel interface represents a network channel which can be used for bidirectional peer-to-peer transfers of arbitrary data.
RTCDataChannelInit can be used to configure properties of the underlying channel such as data reliability.
RTCDtlsFingerprint specifies the hash function algorithm and certificate fingerprint as described in https://tools.ietf.org/html/rfc4572.
RTCDtlsTransport allows an application access to information about the DTLS transport over which RTP and RTCP packets are sent and received by RTCRtpSender and RTCRtpReceiver, as well other data such as SCTP packets sent and received by data channels.
RTCIceServer describes a single STUN and TURN server that can be used by the IceAgent to establish a connection with a peer.
RTCIceTransport allows an application access to information about the ICE transport over which packets are sent and received.
RTCOAuthCredential represents OAuth credential information which is used by the STUN/TURN client to connect to an ICE server as defined in https://tools.ietf.org/html/rfc7635.
RTCOfferAnswerOptions is a base structure which describes the options that can be used to control the offer/answer creation process.
RTCOfferOptions structure describes the options used to control the offer creation process.
RTCPeerConnection represents a WebRTC connection that establishes a peer-to-peer communications with another RTCPeerConnection instance in a browser, or to another endpoint implementing the required protocols.
RTCRtpCapabilities represents the capabilities of a transceiver.
RTCRtpCodec represents a codec supported by the PeerConnection.
RTCRtpCodecCapability provides information about codec capabilities.
RTCRtpHeaderExtensionCapability is used to define a RFC5285 RTP header extension supported by the codec.
RTCRtpReceiver allows an application to inspect the receipt of a RTCTrack.
RTCRtpSender allows an application to control how a given RTCTrack is encoded and transmitted to a remote peer.
RTCRtpTransceiver represents a combination of an RTCRtpSender and an RTCRtpReceiver that share a common mid.
RTCSctpTransport provides details about the SCTP transport.
RTCSessionDescription is used to expose local and remote session descriptions.
RTCTrack represents a track that is communicated.

# Type aliases

RTCBundlePolicy affects which media tracks are negotiated if the remote endpoint is not bundle-aware, and what ICE candidates are gathered.
RTCDataChannelState indicates the state of a data channel.
RTCDtlsTransportState indicates the dtsl transport establishment state.
RTCIceCandidateType represents the type of the ICE candidate used.
RTCIceComponent describes if the ice transport is used for RTP (or RTCP multiplexing).
RTCIceConnectionState indicates signaling state of the Ice Connection.
RTCIceCredentialType indicates the type of credentials used to connect to an ICE server.
RTCIceGatheringState describes the state of the candidate gathering process.
RTCIceProtocol indicates the transport protocol type that is used in the ice.URL structure.
RTCIceRole describes the role ice.Agent is playing in selecting the preferred the candidate pair.
RTCIceTransportPolicy defines the ICE candidate policy surface the permitted candidates.
RTCPeerConnectionState indicates the state of the RTCPeerConnection.
RTCPriorityType determines the priority type of a data channel.
RTCRtcpMuxPolicy affects what ICE candidates are gathered to support non-multiplexed RTCP.
RTCRtpCodecType determines the type of a codec.
RTCRtpTransceiverDirection indicates the direction of the RTCRtpTransceiver.
RTCSctpTransportState indicates the state of the SCTP transport.
RTCSdpType describes the type of an RTCSessionDescription.
RTCSignalingState indicates the signaling state of the offer/answer process.