> Documentation index: https://developer.android.com/reference/llms.txt

# HlsMediaPlaylist.SegmentBase

Artifact: [androidx.media3:media3-exoplayer-hls](https://developer.android.com/jetpack/androidx/releases/media3.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/hls/playlist/HlsMediaPlaylist.java+class:androidx.media3.exoplayer.hls.playlist.HlsMediaPlaylist.SegmentBase)

*** ** * ** ***


```
public class HlsMediaPlaylist.SegmentBase implements Comparable<Long>
```

<br />

Known direct subclasses [HlsMediaPlaylist.Part](https://developer.android.com/reference/androidx/media3/exoplayer/hls/playlist/HlsMediaPlaylist.Part.md.txt), [HlsMediaPlaylist.Segment](https://developer.android.com/reference/androidx/media3/exoplayer/hls/playlist/HlsMediaPlaylist.Segment.md.txt)

|---|---|
| `HlsMediaPlaylist.Part` | A media part. |
| `HlsMediaPlaylist.Segment` | Media segment reference. |

*** ** * ** ***

The base for a `Segment` or a `Part` required for playback.

## Summary

| ### Public fields |
|---|---|
| `final long` | `byteRangeLength` The segment's byte range length, as defined by #EXT-X-BYTERANGE, #EXT-X-PART or #EXT-X-PRELOAD-HINT, or `LENGTH_UNSET` if no byte range is specified or the byte range is open-ended. |
| `final long` | `byteRangeOffset` The segment's byte range offset, as defined by #EXT-X-BYTERANGE, #EXT-X-PART or #EXT-X-PRELOAD-HINT. |
| `final @Nullable DrmInitData` | `drmInitData` DRM initialization data for sample decryption, or null if the segment does not use CDM-DRM protection. |
| `final long` | `durationUs` The duration of the segment in microseconds, as defined by #EXTINF or #EXT-X-PART. |
| `final @Nullable String` | `encryptionIV` The encryption initialization vector as defined by #EXT-X-KEY, or null if the segment is not encrypted. |
| `final @Nullable String` | `fullSegmentEncryptionKeyUri` The encryption identity key uri as defined by #EXT-X-KEY, or null if the segment does not use full segment encryption with identity key. |
| `final boolean` | `hasGapTag` Whether the segment is marked as a gap. |
| `final @Nullable HlsMediaPlaylist.Segment` | `initializationSegment` The media initialization section for this segment, as defined by #EXT-X-MAP. |
| `final int` | `relativeDiscontinuitySequence` The number of #EXT-X-DISCONTINUITY tags in the playlist before the segment. |
| `final long` | `relativeStartTimeUs` The start time of the segment in microseconds, relative to the start of the playlist. |
| `final String` | `url` The url of the segment. |

| ### Public methods |
|---|---|
| `int` | `compareTo(Long relativeStartTimeUs)` |

## Public fields

### byteRangeLength

```
public final long byteRangeLength
```

The segment's byte range length, as defined by #EXT-X-BYTERANGE, #EXT-X-PART or #EXT-X-PRELOAD-HINT, or `LENGTH_UNSET` if no byte range is specified or the byte range is open-ended.

### byteRangeOffset

```
public final long byteRangeOffset
```

The segment's byte range offset, as defined by #EXT-X-BYTERANGE, #EXT-X-PART or #EXT-X-PRELOAD-HINT.

### drmInitData

```
public final @Nullable DrmInitData drmInitData
```

DRM initialization data for sample decryption, or null if the segment does not use CDM-DRM protection.

### durationUs

```
public final long durationUs
```

The duration of the segment in microseconds, as defined by #EXTINF or #EXT-X-PART.

### encryptionIV

```
public final @Nullable String encryptionIV
```

The encryption initialization vector as defined by #EXT-X-KEY, or null if the segment is not encrypted.

### fullSegmentEncryptionKeyUri

```
public final @Nullable String fullSegmentEncryptionKeyUri
```

The encryption identity key uri as defined by #EXT-X-KEY, or null if the segment does not use full segment encryption with identity key.

### hasGapTag

```
public final boolean hasGapTag
```

Whether the segment is marked as a gap.

### initializationSegment

```
public final @Nullable HlsMediaPlaylist.Segment initializationSegment
```

The media initialization section for this segment, as defined by #EXT-X-MAP. May be null if the media playlist does not define a media initialization section for this segment. The same instance is used for all segments that share an EXT-X-MAP tag.

### relativeDiscontinuitySequence

```
public final int relativeDiscontinuitySequence
```

The number of #EXT-X-DISCONTINUITY tags in the playlist before the segment.

### relativeStartTimeUs

```
public final long relativeStartTimeUs
```

The start time of the segment in microseconds, relative to the start of the playlist.

### url

```
public final String url
```

The url of the segment.

## Public methods

### compareTo

```
public int compareTo(Long relativeStartTimeUs)
```