# MusicTrackEntity

# MusicTrackEntity

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/com/google/android/engage/audio/datamodel/MusicTrackEntity "View this page in Java")  

<br />

```
class MusicTrackEntity : Entity
```

<br />

|---|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                             |||
| ↳ | [com.google.android.engage.common.datamodel.Entity](https://developer.android.com/reference/kotlin/com/google/android/engage/common/datamodel/Entity)                      ||
|   | ↳ | [com.google.android.engage.audio.datamodel.MusicTrackEntity](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity) |

*** ** * ** ***

An object representing a music track.

## Summary

|                                                                                                                                           ### Nested types                                                                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[MusicTrackEntity.Builder](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity.Builder) Builder class for[MusicTrackEntity](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity). |

|                                                                                                                                               ### Public functions                                                                                                                                                |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Optional](https://guava.dev/releases/21.0/api/docs/com/google/common/base/Optional.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`!>!`                                                                                                                                 | [getAlbum](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getAlbum())`()` Returns the album of the music track, if it belongs to one.                             |
| `(`[Mutable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`!>!`                         | [getArtists](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getArtists())`()` Returns the list of artists of the music track, if available.                       |
| [Optional](https://guava.dev/releases/21.0/api/docs/com/google/common/base/Optional.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`!>!`                                                                                                                                 | [getDescription](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getDescription())`()` Returns the description of the audio entity, if available                   |
| [Optional](https://guava.dev/releases/21.0/api/docs/com/google/common/base/Optional.html)`<`[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`!>!`                                                                                                                                     | [getDurationMillis](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getDurationMillis())`()` Returns the duration of the music track.                              |
| [Optional](https://guava.dev/releases/21.0/api/docs/com/google/common/base/Optional.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`!>!`                                                                                                                                 | [getEntityId](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getEntityId())`()` Returns the id of the entity.                                                     |
| [Optional](https://guava.dev/releases/21.0/api/docs/com/google/common/base/Optional.html)`<`[Uri](https://developer.android.com/reference/android/net/Uri.html)`!>!`                                                                                                                                              | [getInfoPageUri](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getInfoPageUri())`()` Returns the info page uri of the music track, if available.                 |
| [Optional](https://guava.dev/releases/21.0/api/docs/com/google/common/base/Optional.html)`<`[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`!>!`                                                                                                                                     | [getLastEngagementTimeMillis](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getLastEngagementTimeMillis())`()` Returns the last engagement time in milliseconds. |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`!`                                                                                                                                                                                                                               | [getName](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getName())`()` Returns the name of the entity.                                                           |
| `(`[Mutable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[Image](https://developer.android.com/reference/kotlin/com/google/android/engage/common/datamodel/Image)`!>!` | [getPosterImages](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getPosterImages())`()` Returns the poster image of the entity.                                   |
| [Optional](https://guava.dev/releases/21.0/api/docs/com/google/common/base/Optional.html)`<`[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`!>!`                                                                                                                                       | [getProgressPercentComplete](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#getProgressPercentComplete())`()` Returns the percentage progress completed.          |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                                | [isDownloadedOnDevice](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#isDownloadedOnDevice())`()` Returns whether the music track is downloaded on device or not  |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                                | [isExplicitContent](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#isExplicitContent())`()` Returns whether the music track has explicit content or not           |

|                         ### Public properties                          |
|------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| [Uri](https://developer.android.com/reference/android/net/Uri.html)`!` | [playBackUri](https://developer.android.com/reference/kotlin/com/google/android/engage/audio/datamodel/MusicTrackEntity#playBackUri()) |

|                                                                                                                                                                                                                                                                                         ### Inherited functions                                                                                                                                                                                                                                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[com.google.android.engage.common.datamodel.Entity](https://developer.android.com/reference/kotlin/com/google/android/engage/common/datamodel/Entity) |----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getEntityType](https://developer.android.com/reference/kotlin/com/google/android/engage/common/datamodel/Entity#getEntityType())`()` | |

## Public functions

### getAlbum

```
fun getAlbum(): Optional<String!>!
```

Returns the album of the music track, if it belongs to one.  

### getArtists

```
fun getArtists(): (Mutable)List<String!>!
```

Returns the list of artists of the music track, if available.  

### getDescription

```
fun getDescription(): Optional<String!>!
```

Returns the description of the audio entity, if available  

### getDurationMillis

```
fun getDurationMillis(): Optional<Long!>!
```

Returns the duration of the music track.  

### getEntityId

```
fun getEntityId(): Optional<String!>!
```

Returns the id of the entity.  

### getInfoPageUri

```
fun getInfoPageUri(): Optional<Uri!>!
```

Returns the info page uri of the music track, if available.  

### getLastEngagementTimeMillis

```
fun getLastEngagementTimeMillis(): Optional<Long!>!
```

Returns the last engagement time in milliseconds.  

### getName

```
fun getName(): String!
```

Returns the name of the entity.  

### getPosterImages

```
fun getPosterImages(): (Mutable)List<Image!>!
```

Returns the poster image of the entity.  

### getProgressPercentComplete

```
fun getProgressPercentComplete(): Optional<Int!>!
```

Returns the percentage progress completed.  

### isDownloadedOnDevice

```
fun isDownloadedOnDevice(): Boolean
```

Returns whether the music track is downloaded on device or not  

### isExplicitContent

```
fun isExplicitContent(): Boolean
```

Returns whether the music track has explicit content or not  

## Public properties

### playBackUri

```
val playBackUri: Uri!
```