()
| 27 | } |
| 28 | |
| 29 | func (v *Video) Attach() { |
| 30 | v.Info("attach video track", zap.Uint("width", v.Width), zap.Uint("height", v.Height)) |
| 31 | if err := v.Publisher.GetStream().AddTrack(v).Await(); err != nil { |
| 32 | v.Error("attach video track failed", zap.Error(err)) |
| 33 | } else { |
| 34 | v.Info("video track attached", zap.Uint("width", v.Width), zap.Uint("height", v.Height)) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | func (v *Video) Detach() { |
| 39 | v.Publisher.GetStream().RemoveTrack(v) |