# 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)

*** ** * ** ***


```
@UnstableApi
public final class PlayerId
```

<br />

*** ** * ** ***

Identifier for a player instance.

## Summary

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId` | `https://developer.android.com/reference/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 `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId` to the components requiring one. |
| `static final https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId#UNSET()` A player identifier with unset default values that can be used as a placeholder or for testing. |

| ### Public fields |
|---|---|
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId#name()` A name to identify the player. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId#PlayerId(java.lang.String)(https://developer.android.com/reference/java/lang/String.html playerName)` Creates an instance. |

| ### Public methods |
|---|---|
| `synchronized https://developer.android.com/reference/android/media/metrics/LogSessionId.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 31) https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId#getLogSessionId()()` Returns the `https://developer.android.com/reference/android/media/metrics/LogSessionId.html` for this player instance. |
| `synchronized void` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 31) https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId#setLogSessionId(android.media.metrics.LogSessionId)(https://developer.android.com/reference/android/media/metrics/LogSessionId.html logSessionId)` Set the `https://developer.android.com/reference/android/media/metrics/LogSessionId.html` for this player instance. |

## Constants

### PRELOAD

```
public static final PlayerId PRELOAD
```

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

### UNSET

```
public static final PlayerId UNSET
```

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

## Public fields

### name

```
public final String name
```

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

## Public constructors

### PlayerId

```
public PlayerId(String playerName)
```

Creates an instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html playerName` | The name of the player, for informational purpose only. |

## Public methods

### getLogSessionId

```
@RequiresApi(value = 31)
synchronized public LogSessionId getLogSessionId()
```

Returns the `https://developer.android.com/reference/android/media/metrics/LogSessionId.html` for this player instance.

### setLogSessionId

```
@RequiresApi(value = 31)
synchronized public void setLogSessionId(LogSessionId logSessionId)
```

Set the `https://developer.android.com/reference/android/media/metrics/LogSessionId.html` for this player instance.

Must not be called if already set.