webrtc

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2018 License: MIT Imports: 12 Imported by: 0

README

Pion WebRTC

Build Status GoDoc Go Report Card Coverage Status Codacy Badge

A Golang implementation of the WebRTC API.

See DESIGN.md for the features it offers, and future goals.

Getting Started

This project provides a Go implementation of the WebRTC API. There isn't a application that will fit all your needs, but we provide a few simple examples to show common use cases that you are free to modify and extend to your needs.

What can I build with pion-WebRTC?

pion-WebRTC is here to help you get media/text from A<->B, here are some of the cool things you could build.

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

We still use OpenSSL for DTLS (we are actively working on replacing it) so make sure to install the OpenSSL headers for your platform before using pion-WebRTC.

Ubuntu/Debian

sudo apt-get install libssl-dev

OSX
brew install openssl
export CPATH=`brew --prefix`/opt/openssl/include
export LIBRARY_PATH=`brew --prefix`/opt/openssl/lib
go get -u github.com/pions/webrtc
Fedora

sudo yum install openssl-devel

Windows
  1. Install mingw-w64
  2. Install pkg-config-lite
  3. Build (or install precompiled) openssl for mingw32-w64
  4. Set PKG_CONFIG_PATH to the directory containing openssl.pc (i.e. c:\mingw64\mingw64\lib\pkgconfig)
Example Programs

Examples for common use cases, extend and modify to quickly get started.

Writing your own application

The API should match the Javascript WebRTC API, and the GoDoc is actively maintained

Roadmap

pion-WebRTC is in active development, you can find the roadmap here.

Questions/Support

Sign up for the Golang Slack and join the #pion channel for discussions and support

You can also use Pion mailing list

If you need commercial support/don't want to use public methods you can contact us at team@pion.ly

Contributing

See CONTRIBUTING.md

Contributors

Project Ideas

I am looking to support other interesting WebRTC projects, so if you have something to build please reach out! pion-WebRTC would make a great foundation for.

  • Easy language bindings (Python)
  • Golang SFU
  • Server side processing (video effects or an MCU)

License

MIT License - see LICENSE.md for full text

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RTCPeerConnection

type RTCPeerConnection struct {
	Ontrack                    func(mediaType TrackType, buffers <-chan *rtp.Packet)
	LocalDescription           *sdp.SessionDescription
	OnICEConnectionStateChange func(iceConnectionState ice.ConnectionState)
	// contains filtered or unexported fields
}

RTCPeerConnection represents a WebRTC connection between itself and a remote peer

func (*RTCPeerConnection) AddTrack

func (r *RTCPeerConnection) AddTrack(mediaType TrackType, clockRate uint32) (samples chan<- RTCSample, err error)

AddTrack adds a new track to the RTCPeerConnection This function returns a channel to push buffers on, and an error if the channel can't be added Closing the channel ends this stream

func (*RTCPeerConnection) Close

func (r *RTCPeerConnection) Close() error

Close ends the RTCPeerConnection

func (*RTCPeerConnection) CreateOffer

func (r *RTCPeerConnection) CreateOffer() error

CreateOffer starts the RTCPeerConnection and generates the localDescription The order of CreateOffer/SetRemoteDescription determines if we are the offerer or the answerer Once the RemoteDescription has been set network activity will start

func (*RTCPeerConnection) SetRemoteDescription

func (r *RTCPeerConnection) SetRemoteDescription(rawSessionDescription string) error

SetRemoteDescription sets the SessionDescription of the remote peer

type RTCSample

type RTCSample struct {
	Data    []byte
	Samples uint32
}

RTCSample contains media, and the amount of samples in it

type TrackType

type TrackType int

TrackType determines the type of media we are sending receiving

const (
	VP8 TrackType = iota + 1
	VP9
	Opus
)

List of supported TrackTypes

func (TrackType) String

func (t TrackType) String() string

Directories

Path Synopsis
examples
internal
sdp
pkg
ice
rtp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL