diff --git a/reader.go b/reader.go index 86134762..7e670dc6 100644 --- a/reader.go +++ b/reader.go @@ -323,6 +323,8 @@ func decodeLineOfMasterPlaylist(p *MasterPlaylist, state *decodingState, line st alt.Autoselect = v case "FORCED": alt.Forced = v + case "INSTREAM-ID": + alt.InstreamID = v case "CHARACTERISTICS": alt.Characteristics = v case "SUBTITLES": diff --git a/structure.go b/structure.go index ea0d5c85..82bf94a6 100644 --- a/structure.go +++ b/structure.go @@ -192,6 +192,7 @@ type Alternative struct { Default bool Autoselect string Forced string + InstreamID string Characteristics string Subtitles string } diff --git a/writer.go b/writer.go index ae736067..050b5403 100644 --- a/writer.go +++ b/writer.go @@ -140,6 +140,11 @@ func (p *MasterPlaylist) Encode() *bytes.Buffer { p.buf.WriteString(alt.Forced) p.buf.WriteRune('"') } + if alt.Type == "CLOSED-CAPTIONS" && alt.InstreamID != "" { + p.buf.WriteString(",INSTREAM-ID=\"") + p.buf.WriteString(alt.InstreamID) + p.buf.WriteRune('"') + } if alt.Characteristics != "" { p.buf.WriteString(",CHARACTERISTICS=\"") p.buf.WriteString(alt.Characteristics)