# PlayerId

# PlayerId

Artifact:[androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/analytics/PlayerId.java+class:androidx.media3.exoplayer.analytics.PlayerId)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId "View this page in Java")

<br />

```
@UnstableApi
class PlayerId
```

<br />

*** ** * ** ***

Identifier for a player instance.

## Summary

|                                                   ### Constants                                                    |
|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[PlayerId](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId)`!` | [PRELOAD](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId#PRELOAD()) A player identifier that is used when we preload media outside of a player but have to pass a[PlayerId](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId)to the components requiring one. |
| `const `[PlayerId](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId)`!` | [UNSET](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId#UNSET()) A player identifier with unset default values that can be used as a placeholder or for testing.                                                                                                                                          |

|                                                                                                                   ### Public constructors                                                                                                                   |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PlayerId](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId#PlayerId(java.lang.String))`(playerName: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Creates an instance. |

|                                               ### Public functions                                                |
|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `synchronized `[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)`!` | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = 31)` [getLogSessionId](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId#getLogSessionId())`()` Returns the[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)for this player instance.                                                                                                                                               |
| `synchronized `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                      | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = 31)` [setLogSessionId](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId#setLogSessionId(android.media.metrics.LogSessionId))`(logSessionId: `[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)`!)` Set the[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)for this player instance. |

|                                ### Public properties                                 |
|--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | [name](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId#name()) A name to identify the player. |

## Constants

### PRELOAD

```
const val PRELOAD: PlayerId!
```

A player identifier that is used when we preload media outside of a player but have to pass a[PlayerId](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId)to the components requiring one.  

### UNSET

```
const val UNSET: PlayerId!
```

A player identifier with unset default values that can be used as a placeholder or for testing.  

## Public constructors

### PlayerId

```
PlayerId(playerName: String!)
```

Creates an instance.  

|                                             Parameters                                             |
|----------------------------------------------------------------------------------------------------|---------------------------------------------------------|
| `playerName: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The name of the player, for informational purpose only. |

## Public functions

### getLogSessionId

```
@RequiresApi(value = 31)
synchronized fun getLogSessionId(): LogSessionId!
```

Returns the[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)for this player instance.  

### setLogSessionId

```
@RequiresApi(value = 31)
synchronized fun setLogSessionId(logSessionId: LogSessionId!): Unit
```

Set the[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)for this player instance.

Must not be called if already set.  

## Public properties

### name

```
val name: String!
```

A name to identify the player. Use[setName](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlayer.Builder#setName(java.lang.String))to set the name, otherwise an empty string is used as the default.