# ImaAdTagUriBuilder

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

*** ** * ** ***


```
@UnstableApi
public final class ImaAdTagUriBuilder
```

<br />

*** ** * ** ***

Builder for URI for IMA client side ad insertion streams.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/annotation/IntDef(value = ) @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) public annotation https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder.ImaOrientationType` Types of video orientations. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder#IMA_ORIENTATION_LANDSCAPE() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder#IMA_ORIENTATION_PORTRAIT() = 2` |
| `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder#IMA_ORIENTATION_SQUARE() = 3` |
| `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder#IMA_ORIENTATION_UNSET() = 0` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder#ImaAdTagUriBuilder(android.net.Uri)(https://developer.android.com/reference/android/net/Uri.html uri)` Creates a new instance. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder#build()()` Builds a URI with the builder's current values. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder#setPreferredLinearOrientation(int)( @https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder.ImaOrientationType int preferredLinearOrientation )` Sets the preferred linear orientation to be used. |

## Constants

### IMA_ORIENTATION_LANDSCAPE

```
public static final int IMA_ORIENTATION_LANDSCAPE = 1
```

### IMA_ORIENTATION_PORTRAIT

```
public static final int IMA_ORIENTATION_PORTRAIT = 2
```

### IMA_ORIENTATION_SQUARE

```
public static final int IMA_ORIENTATION_SQUARE = 3
```

### IMA_ORIENTATION_UNSET

```
public static final int IMA_ORIENTATION_UNSET = 0
```

## Public constructors

### ImaAdTagUriBuilder

```
public ImaAdTagUriBuilder(Uri uri)
```

Creates a new instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/net/Uri.html uri` | The URI. |

## Public methods

### build

```
public Uri build()
```

Builds a URI with the builder's current values. This URI can be used in the call to AdConfiguration.Builder.setAdTagUri().

| Returns |
|---|---|
| `https://developer.android.com/reference/android/net/Uri.html` | The build `https://developer.android.com/reference/android/net/Uri.html`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If the builder has missing or invalid inputs. |

### setPreferredLinearOrientation

```
@CanIgnoreReturnValue
public ImaAdTagUriBuilder setPreferredLinearOrientation(
    @ImaAdTagUriBuilder.ImaOrientationType int preferredLinearOrientation
)
```

Sets the preferred linear orientation to be used. The publisher can specify an orientation that ads should be displayed in.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder.ImaOrientationType int preferredLinearOrientation` | The preferred linear orientation. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ima/ImaAdTagUriBuilder` | This instance, for convenience. |