| 973 | } |
| 974 | |
| 975 | func (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 |
| 997 | func (c *RTCClient) SendAddTrack(cid string, mimeType string, name string, trackType livekit.TrackType) error { |