Add HLS VOD support
This commit is contained in:
@@ -790,7 +790,7 @@ InitBuffer:
|
||||
}
|
||||
|
||||
// Video Stream (TS)
|
||||
case "video/mpeg", "video/mp4", "video/mp2t", "application/octet-stream":
|
||||
case "video/mpeg", "video/mp4", "video/mp2t", "application/octet-stream", "binary/octet-stream":
|
||||
|
||||
var fileSize int
|
||||
|
||||
@@ -1027,7 +1027,7 @@ func parseM3U8(stream *ThisStream) (err error) {
|
||||
|
||||
line = strings.Trim(line, "\r\n")
|
||||
|
||||
var parameters = []string{"#EXT-X-VERSION:", "#EXT-X-MEDIA-SEQUENCE:", "#EXT-X-STREAM-INF:", "#EXTINF:"}
|
||||
var parameters = []string{"#EXT-X-VERSION:", "#EXT-X-PLAYLIST-TYPE:", "#EXT-X-MEDIA-SEQUENCE:", "#EXT-X-STREAM-INF:", "#EXTINF:"}
|
||||
|
||||
for _, parameter := range parameters {
|
||||
|
||||
@@ -1043,6 +1043,9 @@ func parseM3U8(stream *ThisStream) (err error) {
|
||||
segment.Version = version
|
||||
}
|
||||
|
||||
case "#EXT-X-PLAYLIST-TYPE:":
|
||||
segment.PlaylistType = value
|
||||
|
||||
case "#EXT-X-MEDIA-SEQUENCE:":
|
||||
n, err := strconv.ParseInt(value, 10, 64)
|
||||
if err == nil {
|
||||
@@ -1194,6 +1197,11 @@ func parseM3U8(stream *ThisStream) (err error) {
|
||||
noNewSegment = false
|
||||
stream.LastSequence = segment.Sequence
|
||||
|
||||
// Stream ist vom Typ VOD. Es muss das erste Segment der M3U8 Playlist verwendet werden.
|
||||
if strings.ToUpper(segment.PlaylistType) == "VOD" {
|
||||
break
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if segment.Sequence > stream.LastSequence {
|
||||
|
||||
@@ -68,12 +68,13 @@ type ThisStream struct {
|
||||
|
||||
// Segment : URL Segmente (HLS / M3U8)
|
||||
type Segment struct {
|
||||
Duration float64
|
||||
Info bool
|
||||
Sequence int64
|
||||
URL string
|
||||
Version int
|
||||
Wait float64
|
||||
Duration float64
|
||||
Info bool
|
||||
PlaylistType string
|
||||
Sequence int64
|
||||
URL string
|
||||
Version int
|
||||
Wait float64
|
||||
|
||||
StreamInf struct {
|
||||
AverageBandwidth int
|
||||
|
||||
66
src/webUI.go
66
src/webUI.go
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user