# How do you know when a stream or an advertisement is playing on Android?

This guide explains how to determine programmatically when the player is playing, and whether it is playing a stream or a client-side advertisement. This is useful when you want different behavior, or a different UI, for content and for advertisements.

The `playing` event tells you when content or an advertisement starts playing. Its event handler is the right place to check whether an advertisement is playing.

This approach only works for client-side advertisements, not for server-side advertisements.

## Usage

The Android SDK exposes whether an advertisement is playing through [`player.ads.isPlaying()`](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/v11/api-reference/android/com/theoplayer/android/api/ads/Ads#isPlaying\(\)).

```kotlin
player.addEventListener(PlayerEventTypes.PLAYING) { event ->
    val adIsPlaying = player.ads.isPlaying
    println("PLAYING " + if (adIsPlaying) "Advertisement" else "Content")
}
```

## Related articles

* [How to track the first play(ing) event](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/how-to-guides/android/player/track-first-playing-event.md)
