Skip to content

how can I access playlist items fields #2

@alixTal

Description

@alixTal

Hi, I am new to Golang, I'm using your example for reading a playlist,

playlist, err := m3u8.Read(resp.Body)

fmt.Println(reflect.TypeOf(playlist.Items[0]))
fmt.Println(playlist.Items[0])

output

*m3u8.SegmentItem
#EXTINF:10,
https://multiplatform-f.akamaihd.net/i/multi/will/bunny/big_buck_bunny_,640x360_400,640x360_700,640x360_1000,950x540_1500,.f4v.csmil/segment1_0_av.ts

I looked at Segmentitem type and it has these fields:

type SegmentItem struct {
	Duration        float64
	Segment         string
	Comment         *string
	ProgramDateTime *TimeItem
	ByteRange       *ByteRange
}

when I want to get access to playlist.Items[0].Segment I get this error.

playlist.Items[0].Segment undefined (type m3u8.Item has no field or method Segment)

I want to know how can I access the playlist item fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions