SubtitleData

Added in 1.1.0
Deprecated in 1.3.0

class SubtitleData : VersionedParcelable


Class encapsulating subtitle data, as received through the onSubtitleData interface. The subtitle data includes:

  • the start time (in microseconds) of the data
  • the duration (in microseconds) of the data
  • the actual data.
The data is stored in a byte-array, and is encoded in one of the supported in-band subtitle formats. The subtitle encoding is determined by the MIME type of the of the subtitle track, one of MIMETYPE_TEXT_CEA_608 or MIMETYPE_TEXT_CEA_708.

Here is an example of iterating over the tracks of a SessionPlayer, and checking which encoding is used for the subtitle tracks:

// Initialize instance of player that extends SessionPlayer
SessionPlayerExtension player = new SessionPlayerExtension();

final TrackInfo[] trackInfos = player.getTrackInfo();
for (TrackInfo info : trackInfo) {
    if (info.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE) {
        final String mime = info.getFormat().getString(MediaFormat.KEY_MIME);
        if ("text/cea-608".equals(mime) {
            // subtitle encoding is CEA 608
        } else if ("text/cea-708".equals(mime) {
            // subtitle encoding is CEA 708
        }
    }
}

Summary

Public constructors

SubtitleData(startTimeUs: Long, durationUs: Long, data: ByteArray)

Public functions

Boolean
equals(o: Any?)
ByteArray<Byte>

Returns the encoded data for the subtitle content.

Long

Returns the duration in microsecond during which the subtitle should be displayed.

Long

Returns the media time at which the subtitle should be displayed, expressed in microseconds.

Int

Public constructors

SubtitleData

Added in 1.1.0
Deprecated in 1.3.0
SubtitleData(startTimeUs: Long, durationUs: Long, data: ByteArray)

Public functions

equals

fun equals(o: Any?): Boolean

getData

Added in 1.1.0
Deprecated in 1.3.0
fun getData(): ByteArray<Byte>

Returns the encoded data for the subtitle content. Encoding format depends on the subtitle type, refer to CEA 708, and CEA/EIA 608 defined by the MIME type of the subtitle track.

Returns
ByteArray<Byte>

the encoded subtitle data

getDurationUs

Added in 1.1.0
Deprecated in 1.3.0
fun getDurationUs(): Long

Returns the duration in microsecond during which the subtitle should be displayed.

Returns
Long

the display duration for the subtitle

getStartTimeUs

Added in 1.1.0
Deprecated in 1.3.0
fun getStartTimeUs(): Long

Returns the media time at which the subtitle should be displayed, expressed in microseconds.

Returns
Long

the display start time for the subtitle

hashCode

fun hashCode(): Int