diff --git a/examples/rtp/main.go b/examples/rtp/main.go index 22f1906..1295132 100644 --- a/examples/rtp/main.go +++ b/examples/rtp/main.go @@ -47,7 +47,7 @@ func main() { }) must(err) - videoTrack := mediaStream.GetVideoTracks()[0].(*mediadevices.VideoTrack) + videoTrack := mediaStream.GetVideoTracks()[0] defer videoTrack.Close() rtpReader, err := videoTrack.NewRTPReader(vp8Params.RTPCodec().Name, mtu) diff --git a/track.go b/track.go index df05618..273df5e 100644 --- a/track.go +++ b/track.go @@ -54,6 +54,9 @@ type Track interface { // Unbind is the clean up operation that should be called after Bind. Similar to Bind, unbind will // be called automatically in the future. Unbind(*webrtc.PeerConnection) error + // NewRTPReader creates a new reader from the source. The reader will encode the source, and packetize + // the encoded data in RTP format with given mtu size. + NewRTPReader(codecName string, mtu int) (RTPReadCloser, error) } type baseTrack struct {