# VideoSize

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

*** ** * ** ***


```
public final class VideoSize
```

<br />

*** ** * ** ***

Represents the video size.

## Summary

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/media3/common/VideoSize` | `https://developer.android.com/reference/androidx/media3/common/VideoSize#UNKNOWN()` |

| ### Public fields |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/media3/common/VideoSize#height()` The video height in pixels, 0 when unknown. |
| `final @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, fromInclusive = false) float` | `https://developer.android.com/reference/androidx/media3/common/VideoSize#pixelWidthHeightRatio()` The width to height ratio of each pixel, 1 if unknown. |
| `final @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 359) int` | `https://developer.android.com/reference/androidx/media3/common/VideoSize#unappliedRotationDegrees()` **This field is deprecated.** Rotation is handled internally by the player, so this is always zero. <br /> |
| `final @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/media3/common/VideoSize#width()` The video width in pixels, 0 when unknown. |

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/VideoSize#VideoSize(int,int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int width, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int height)` Creates a VideoSize without unapplied rotation or anamorphic content. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/VideoSize#VideoSize(int,int,float)( @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int width, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int height, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, fromInclusive = false) float pixelWidthHeightRatio )` Creates a new instance. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [VideoSize](https://developer.android.com/reference/androidx/media3/common/VideoSize#VideoSize(int,int,int,float))( @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int width, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int height, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 359) int unappliedRotationDegrees, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, fromInclusive = false) float pixelWidthHeightRatio )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/VideoSize#VideoSize(int,int,float)` instead. <br /> |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/VideoSize#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` |
| `static https://developer.android.com/reference/androidx/media3/common/VideoSize` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/VideoSize#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `VideoSize` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `int` | `https://developer.android.com/reference/androidx/media3/common/VideoSize#hashCode()()` |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/VideoSize#toBundle()()` |

## Constants

### UNKNOWN

```
public static final VideoSize UNKNOWN
```

## Public fields

### height

```
public final @IntRange(from = 0) int height
```

The video height in pixels, 0 when unknown.

### pixelWidthHeightRatio

```
public final @FloatRange(from = 0, fromInclusive = false) float pixelWidthHeightRatio
```

The width to height ratio of each pixel, 1 if unknown.

For the normal case of square pixels this will be equal to 1.0. Different values are indicative of anamorphic content.

### unappliedRotationDegrees

```
public final @IntRange(from = 0, to = 359) int unappliedRotationDegrees
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Rotation is handled internally by the player, so this is always zero.

### width

```
public final @IntRange(from = 0) int width
```

The video width in pixels, 0 when unknown.

## Public constructors

### VideoSize

```
@UnstableApi
public VideoSize(@IntRange(from = 0) int width, @IntRange(from = 0) int height)
```

Creates a VideoSize without unapplied rotation or anamorphic content.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int width` | The video width in pixels. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int height` | The video height in pixels. |

### VideoSize

```
@UnstableApi
public VideoSize(
    @IntRange(from = 0) int width,
    @IntRange(from = 0) int height,
    @FloatRange(from = 0, fromInclusive = false) float pixelWidthHeightRatio
)
```

Creates a new instance.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int width` | The video width in pixels. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int height` | The video height in pixels. |
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, fromInclusive = false) float pixelWidthHeightRatio` | The width to height ratio of each pixel. For the normal case of square pixels this will be equal to 1.0. Different values are indicative of anamorphic content. |

### VideoSize

```
@UnstableApi
public [VideoSize](https://developer.android.com/reference/androidx/media3/common/VideoSize#VideoSize(int,int,int,float))(
    @IntRange(from = 0) int width,
    @IntRange(from = 0) int height,
    @IntRange(from = 0, to = 359) int unappliedRotationDegrees,
    @FloatRange(from = 0, fromInclusive = false) float pixelWidthHeightRatio
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/VideoSize#VideoSize(int,int,float)` instead. `
> unappliedRotationDegrees` is not needed on API 21+ and is always zero.

## Public methods

### equals

```
public boolean equals(@Nullable Object obj)
```

### fromBundle

```
@UnstableApi
public static VideoSize fromBundle(Bundle bundle)
```

Restores a `VideoSize` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### hashCode

```
public int hashCode()
```

### toBundle

```
@UnstableApi
public Bundle toBundle()
```