HTTPAPIServerStreamCodec stream codec
(c *gin.Context)
| 69 | |
| 70 | //HTTPAPIServerStreamCodec stream codec |
| 71 | func HTTPAPIServerStreamCodec(c *gin.Context) { |
| 72 | if Config.ext(c.Param("uuid")) { |
| 73 | Config.RunIFNotRun(c.Param("uuid")) |
| 74 | codecs := Config.coGe(c.Param("uuid")) |
| 75 | if codecs == nil { |
| 76 | return |
| 77 | } |
| 78 | var tmpCodec []JCodec |
| 79 | for _, codec := range codecs { |
| 80 | if codec.Type() != av.H264 && codec.Type() != av.PCM_ALAW && codec.Type() != av.PCM_MULAW && codec.Type() != av.OPUS { |
| 81 | log.Println("Codec Not Supported WebRTC ignore this track", codec.Type()) |
| 82 | continue |
| 83 | } |
| 84 | if codec.Type().IsVideo() { |
| 85 | tmpCodec = append(tmpCodec, JCodec{Type: "video"}) |
| 86 | } else { |
| 87 | tmpCodec = append(tmpCodec, JCodec{Type: "audio"}) |
| 88 | } |
| 89 | } |
| 90 | b, err := json.Marshal(tmpCodec) |
| 91 | if err == nil { |
| 92 | _, err = c.Writer.Write(b) |
| 93 | if err != nil { |
| 94 | log.Println("Write Codec Info error", err) |
| 95 | return |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | //HTTPAPIServerStreamWebRTC stream video over WebRTC |
| 102 | func HTTPAPIServerStreamWebRTC(c *gin.Context) { |
nothing calls this directly
no test coverage detected