public final class

MediaLoadData

extends java.lang.Object

 java.lang.Object

↳androidx.media3.exoplayer.source.MediaLoadData

Gradle dependencies

compile group: 'androidx.media3', name: 'media3-exoplayer', version: '1.5.0-alpha01'

  • groupId: androidx.media3
  • artifactId: media3-exoplayer
  • version: 1.5.0-alpha01

Artifact androidx.media3:media3-exoplayer:1.5.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

Descriptor for data being loaded or selected by a MediaSource.

Summary

Fields
public final intdataType

The data type.

public final longmediaEndTimeMs

The end time of the media in the MediaPeriod, or C.TIME_UNSET if the data does not belong to a specific MediaPeriod or the end time is unknown.

public final longmediaStartTimeMs

The start time of the media in the MediaPeriod, or C.TIME_UNSET if the data does not belong to a specific MediaPeriod.

public final FormattrackFormat

The format of the track to which the data belongs.

public final java.lang.ObjecttrackSelectionData

Optional data associated with the selection of the track to which the data belongs.

public final inttrackSelectionReason

One of the selection reasons if the data belongs to a track.

public final inttrackType

One of the track types, which is a media track type if the data corresponds to media of a specific type, or C.TRACK_TYPE_UNKNOWN otherwise.

Constructors
publicMediaLoadData(int dataType)

Creates an instance with the given MediaLoadData.dataType.

publicMediaLoadData(int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeMs, long mediaEndTimeMs)

Creates media load data.

Methods
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public final int dataType

The data type.

public final int trackType

One of the track types, which is a media track type if the data corresponds to media of a specific type, or C.TRACK_TYPE_UNKNOWN otherwise.

public final Format trackFormat

The format of the track to which the data belongs. Null if the data does not belong to a specific track.

public final int trackSelectionReason

One of the selection reasons if the data belongs to a track. C.SELECTION_REASON_UNKNOWN otherwise.

public final java.lang.Object trackSelectionData

Optional data associated with the selection of the track to which the data belongs. Null if the data does not belong to a track.

public final long mediaStartTimeMs

The start time of the media in the MediaPeriod, or C.TIME_UNSET if the data does not belong to a specific MediaPeriod.

public final long mediaEndTimeMs

The end time of the media in the MediaPeriod, or C.TIME_UNSET if the data does not belong to a specific MediaPeriod or the end time is unknown.

Constructors

public MediaLoadData(int dataType)

Creates an instance with the given MediaLoadData.dataType.

public MediaLoadData(int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeMs, long mediaEndTimeMs)

Creates media load data.

Parameters:

dataType: See MediaLoadData.dataType.
trackType: See MediaLoadData.trackType.
trackFormat: See MediaLoadData.trackFormat.
trackSelectionReason: See MediaLoadData.trackSelectionReason.
trackSelectionData: See MediaLoadData.trackSelectionData.
mediaStartTimeMs: See MediaLoadData.mediaStartTimeMs.
mediaEndTimeMs: See MediaLoadData.mediaEndTimeMs.

Source

/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package androidx.media3.exoplayer.source;

import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.C.DataType;
import androidx.media3.common.C.SelectionReason;
import androidx.media3.common.C.TrackType;
import androidx.media3.common.Format;
import androidx.media3.common.util.UnstableApi;

/** Descriptor for data being loaded or selected by a {@link MediaSource}. */
@UnstableApi
public final class MediaLoadData {

  /** The {@link DataType data type}. */
  public final @DataType int dataType;

  /**
   * One of the {@link TrackType track types}, which is a media track type if the data corresponds
   * to media of a specific type, or {@link C#TRACK_TYPE_UNKNOWN} otherwise.
   */
  public final @TrackType int trackType;

  /**
   * The format of the track to which the data belongs. Null if the data does not belong to a
   * specific track.
   */
  @Nullable public final Format trackFormat;

  /**
   * One of the {@link SelectionReason selection reasons} if the data belongs to a track. {@link
   * C#SELECTION_REASON_UNKNOWN} otherwise.
   */
  public final @C.SelectionReason int trackSelectionReason;

  /**
   * Optional data associated with the selection of the track to which the data belongs. Null if the
   * data does not belong to a track.
   */
  @Nullable public final Object trackSelectionData;

  /**
   * The start time of the media in the {@link MediaPeriod}, or {@link C#TIME_UNSET} if the data
   * does not belong to a specific {@link MediaPeriod}.
   */
  public final long mediaStartTimeMs;

  /**
   * The end time of the media in the {@link MediaPeriod}, or {@link C#TIME_UNSET} if the data does
   * not belong to a specific {@link MediaPeriod} or the end time is unknown.
   */
  public final long mediaEndTimeMs;

  /** Creates an instance with the given {@link #dataType}. */
  public MediaLoadData(@DataType int dataType) {
    this(
        dataType,
        /* trackType= */ C.TRACK_TYPE_UNKNOWN,
        /* trackFormat= */ null,
        /* trackSelectionReason= */ C.SELECTION_REASON_UNKNOWN,
        /* trackSelectionData= */ null,
        /* mediaStartTimeMs= */ C.TIME_UNSET,
        /* mediaEndTimeMs= */ C.TIME_UNSET);
  }

  /**
   * Creates media load data.
   *
   * @param dataType See {@link #dataType}.
   * @param trackType See {@link #trackType}.
   * @param trackFormat See {@link #trackFormat}.
   * @param trackSelectionReason See {@link #trackSelectionReason}.
   * @param trackSelectionData See {@link #trackSelectionData}.
   * @param mediaStartTimeMs See {@link #mediaStartTimeMs}.
   * @param mediaEndTimeMs See {@link #mediaEndTimeMs}.
   */
  public MediaLoadData(
      @DataType int dataType,
      @TrackType int trackType,
      @Nullable Format trackFormat,
      @SelectionReason int trackSelectionReason,
      @Nullable Object trackSelectionData,
      long mediaStartTimeMs,
      long mediaEndTimeMs) {
    this.dataType = dataType;
    this.trackType = trackType;
    this.trackFormat = trackFormat;
    this.trackSelectionReason = trackSelectionReason;
    this.trackSelectionData = trackSelectionData;
    this.mediaStartTimeMs = mediaStartTimeMs;
    this.mediaEndTimeMs = mediaEndTimeMs;
  }
}