{"modulePath":"github.com/Monibuca/plugin-hls","version":"v1.3.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package hls\n\n## Constants\n\n```go\nconst (\n\tHLS_KEY_METHOD_AES_128 = \"AES-128\"\n)\n```\n\n## Types\n\n```go\ntype HLS struct {\n\tTS\n\tHLSInfo\n\tTsHead      http.Header     //用于提供cookie等特殊身份的http头\n\tSaveContext context.Context //用来保存ts文件到服务器\n}\n```\nHLS 发布者\n\n```go\nfunc (p *HLS) Publish(streamName string) (result bool)\n```\n\n```go\ntype HLSInfo struct {\n\tVideo  M3u8Info\n\tAudio  M3u8Info\n\tTSInfo *TSInfo\n}\n```\nHLSInfo 可序列化信息，供控制台查看\n\n```go\ntype M3u8Info struct {\n\tReq       *http.Request `json:\"-\"`\n\tM3U8Count int           //一共拉取的m3u8文件数量\n\tTSCount   int           //一共拉取的ts文件数量\n\tLastM3u8  string        //最后一个m3u8文件内容\n\tM3u8Info  []TSCost      //每一个ts文件的消耗\n}\n```\nM3u8Info m3u8文件的信息，用于拉取m3u8文件，和提供查询\n\n```go\ntype Playlist struct {\n\tExtM3U         string      // indicates that the file is an Extended M3U [M3U] Playlist file. (4.3.3.1) -- 每个M3U文件第一行必须是这个tag.\n\tVersion        int         // indicates the compatibility version of the Playlist file. (4.3.1.2) -- 协议版本号.\n\tSequence       int         // indicates the Media Sequence Number of the first Media Segment that appears in a Playlist file. (4.3.3.2) -- 第一个媒体段的序列号.\n\tTargetduration int         // specifies the maximum Media Segment duration. (4.3.3.1) -- 每个视频分段最大的时长(单位秒).\n\tPlaylistType   int         // rovides mutability information about the Media Playlist file. (4.3.3.5) -- 提供关于PlayList的可变性的信息.\n\tDiscontinuity  int         // indicates a discontinuity between theMedia Segment that follows it and the one that preceded it. (4.3.2.3) -- 该标签后边的媒体文件和之前的媒体文件之间的编码不连贯(即发生改变)(场景用于插播广告等等).\n\tKey            PlaylistKey // specifies how to decrypt them. (4.3.2.4) -- 解密媒体文件的必要信息(表示怎么对media segments进行解码).\n\tEndList        string      // indicates that no more Media Segments will be added to the Media Playlist file. (4.3.3.4) -- 标示没有更多媒体文件将会加入到播放列表中,它可能会出现在播放列表文件的任何地方,但是不能出现两次或以上.\n\tInf            PlaylistInf // specifies the duration of a Media Segment. (4.3.2.1) -- 指定每个媒体段(ts)的持续时间.\n}\n```\n以”#EXT“开头的表示一个”tag“,否则表示注释,直接忽略\n\n```go\nfunc (this *Playlist) GetInfCount(filename string) (num int, err error)\n```\n\n```go\nfunc (this *Playlist) Init(filename string) (err error)\n```\n\n```go\nfunc (this *Playlist) UpdateInf(filename string, tmpFilename string, inf PlaylistInf) (err error)\n```\n\n```go\nfunc (this *Playlist) WriteInf(filename string, inf PlaylistInf) (err error)\n```\n\n```go\ntype PlaylistInf struct {\n\tDuration float64\n\tTitle    string\n}\n```\n\n```go\ntype PlaylistKey struct {\n\tMethod string // specifies the encryption method. (4.3.2.4)\n\tUri    string // key url. (4.3.2.4)\n\tIV     string // key iv. (4.3.2.4)\n}\n```\n\n```go\ntype TSCost struct {\n\tDownloadCost int\n\tDecodeCost   int\n\tBufferLength int\n}\n```\nTSCost ts文件拉取的消耗信息\n\n","path":"github.com/Monibuca/plugin-hls","name":"hls","synopsis":"","isRedistributable":true}
