Avoid defaultAPI

Relates to #434
This commit is contained in:
backkem
2019-02-21 20:58:41 +01:00
committed by Michiel De Backker
parent 4fe2728721
commit 36cf0df239
9 changed files with 33 additions and 57 deletions

View File

@@ -45,6 +45,16 @@ const (
)
func main() {
// Create a MediaEngine object to configure the supported codec
m := webrtc.MediaEngine{}
// Setup the codecs you want to use.
// Only support VP8, this makes our proxying code simpler
m.RegisterCodec(webrtc.NewRTPVP8Codec(webrtc.DefaultPayloadTypeVP8, 90000))
// Create the API object with the MediaEngine
api := webrtc.NewAPI(webrtc.WithMediaEngine(m))
port := flag.Int("port", 8080, "http server port")
flag.Parse()
@@ -66,13 +76,10 @@ func main() {
signal.Decode(mustReadHTTP(sdp), &offer)
fmt.Println("")
/* Everything below is the pion-WebRTC API, thanks for using it! */
// Only support VP8, this makes our proxying code simpler
webrtc.RegisterCodec(webrtc.NewRTPVP8Codec(webrtc.DefaultPayloadTypeVP8, 90000))
// Everything below is the pion-WebRTC API, thanks for using it ❤️.
// Create a new RTCPeerConnection
peerConnection, err := webrtc.NewPeerConnection(peerConnectionConfig)
peerConnection, err := api.NewPeerConnection(peerConnectionConfig)
if err != nil {
panic(err)
}
@@ -146,7 +153,7 @@ func main() {
signal.Decode(mustReadHTTP(sdp), &recvOnlyOffer)
// Create a new PeerConnection
peerConnection, err := webrtc.NewPeerConnection(peerConnectionConfig)
peerConnection, err := api.NewPeerConnection(peerConnectionConfig)
if err != nil {
panic(err)
}