func NewPlaylist(uri string, name string, nseg int, size float64) (*Playlist, error) {
	base := filepath.Base(name)
	u, err := url.Parse(uri)
	if err != nil {
		return nil, err
	}
	u.Path = path.Join(u.Path, base)
	return &Playlist{
		Version:  4,
		URI:      u.String(),
		FileName: name,
		Segments: make([]Segment, nseg),
		SegSize:  size,
		First:    -1,
		Last:     -1,
	}, nil
}
NewPlaylist verifies that file exists and accessible for reading then instantiates Playlist.
package hls
import (
	"bytes"
	"net/url"
	"path"
	"path/filepath"
	"strconv"
)
const (
	SegmentTypeMPEGTS = iota
	SegmentTypeFMP4
)
type (
	Segment struct {
		Duration float64
		Position int64
		Length   int64
	}
	Playlist struct {
		Version  int        
		FileName string     
		URI      string     
		Segments []Segment  
		SegSize  float64    
		First    int        
		Last     int        
	}
)