声音部分的代码仍需调试,现在panic
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/pion/mediadevices/pkg/codec/opus"
|
||||
"github.com/pion/mediadevices/pkg/codec/x264"
|
||||
"github.com/pion/mediadevices/pkg/driver"
|
||||
"github.com/pion/mediadevices/pkg/prop"
|
||||
"github.com/pion/webrtc/v3"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -45,7 +46,10 @@ func New(o *Options) (*Connection, error) {
|
||||
}
|
||||
|
||||
s, err := mediadevices.GetUserMedia(mediadevices.MediaStreamConstraints{
|
||||
Video: func(mtc *mediadevices.MediaTrackConstraints) {},
|
||||
Video: func(mtc *mediadevices.MediaTrackConstraints) {
|
||||
mtc.Height = prop.Int(o.Video.Height)
|
||||
mtc.Width = prop.Int(o.Video.Width)
|
||||
},
|
||||
Audio: func(mtc *mediadevices.MediaTrackConstraints) {},
|
||||
Codec: codecSelector,
|
||||
})
|
||||
@@ -84,7 +88,7 @@ func (c *Connection) Regist(offer *webrtc.SessionDescription) (*webrtc.SessionDe
|
||||
|
||||
for _, track := range c.stream.GetTracks() {
|
||||
track.OnEnded(func(err error) {
|
||||
logrus.Errorf("Track (ID: %s) ended with error: %v", track.ID(), err)
|
||||
logrus.Errorf("Track (ID: %s, kind: %s) ended with error: %v", track.ID(), track.Kind().String(), err)
|
||||
})
|
||||
_, err := rtc.AddTransceiverFromTrack(track, webrtc.RTPTransceiverInit{
|
||||
Direction: webrtc.RTPTransceiverDirectionSendonly,
|
||||
|
Reference in New Issue
Block a user