mirror of
https://github.com/pion/webrtc.git
synced 2025-10-30 10:16:36 +08:00
committed by
Michiel De Backker
parent
4fe2728721
commit
36cf0df239
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user