MCPcopy
hub / github.com/livekit/livekit / AddFileTrack

Method AddFileTrack

test/client/client.go:975–994  ·  view source on GitHub ↗
(path string, id string, label string)

Source from the content-addressed store, hash-verified

973}
974
975func (c *RTCClient) AddFileTrack(path string, id string, label string) (writer TrackWriter, err error) {
976 // determine file mime
977 mime, ok := extMimeMapping[filepath.Ext(path)]
978 if !ok {
979 return nil, fmt.Errorf("%s has an unsupported extension", filepath.Base(path))
980 }
981
982 logger.Debugw("adding file track", "mime", mime)
983
984 track, err := webrtc.NewTrackLocalStaticSample(
985 webrtc.RTPCodecCapability{MimeType: mime},
986 id,
987 label,
988 )
989 if err != nil {
990 return
991 }
992
993 return c.AddTrack(track, path)
994}
995
996// send AddTrack command to server to initiate server-side negotiation
997func (c *RTCClient) SendAddTrack(cid string, mimeType string, name string, trackType livekit.TrackType) error {

Callers

nothing calls this directly

Calls 1

AddTrackMethod · 0.95

Tested by

no test coverage detected