# VideoSize

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

*** ** * ** ***

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

<br />

```
class VideoSize
```

<br />

*** ** * ** ***

Represents the video size.

## Summary

|                                              ### Constants                                              |
|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
| `const `[VideoSize](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize)`!` | [UNKNOWN](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#UNKNOWN()) |

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

|                                             ### Public functions                                              |
|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                           | [equals](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#equals(java.lang.Object))`(obj: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)`                                                                                                                                                                                                                        |
| `java-static `[VideoSize](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize)`!` | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [fromBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#fromBundle(android.os.Bundle))`(bundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`!)` Restores a`VideoSize`from a[Bundle](https://developer.android.com/reference/android/os/Bundle.html). |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                   | [hashCode](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#hashCode())`()`                                                                                                                                                                                                                                                                                                                       |
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html)`!`                                   | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [toBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#toBundle())`()`                                                                                                                                                                                                              |

|                                                                                               ### Public properties                                                                                               |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                | [height](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#height()) The video height in pixels, 0 when unknown.                                                                                                       |
| `@`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [pixelWidthHeightRatio](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#pixelWidthHeightRatio()) The width to height ratio of each pixel, 1 if unknown.                                                              |
| `@`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0, to = 359) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                      | [unappliedRotationDegrees](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#unappliedRotationDegrees()) **This property is deprecated.** Rotation is handled internally by the player, so this is always zero. <br /> |
| `@`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                | [width](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#width()) The video width in pixels, 0 when unknown.                                                                                                          |

## Constants

### UNKNOWN

```
const val UNKNOWN: VideoSize!
```  

## Public constructors

### VideoSize

```
@UnstableApi
VideoSize(width: @IntRange(from = 0) Int, height: @IntRange(from = 0) Int)
```

Creates a VideoSize without unapplied rotation or anamorphic content.  

|                                                                                         Parameters                                                                                         |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| `width: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | The video width in pixels.  |
| `height: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The video height in pixels. |

### VideoSize

```
@UnstableApi
VideoSize(
    width: @IntRange(from = 0) Int,
    height: @IntRange(from = 0) Int,
    pixelWidthHeightRatio: @FloatRange(from = 0, fromInclusive = false) Float
)
```

Creates a new instance.  

|                                                                                                                Parameters                                                                                                                |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `width: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                | The video width in pixels.                                                                                                                                      |
| `height: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                               | The video height in pixels.                                                                                                                                     |
| `pixelWidthHeightRatio: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | 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
[VideoSize](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#VideoSize(int,int,int,float))(
    width: @IntRange(from = 0) Int,
    height: @IntRange(from = 0) Int,
    unappliedRotationDegrees: @IntRange(from = 0, to = 359) Int,
    pixelWidthHeightRatio: @FloatRange(from = 0, fromInclusive = false) Float
)
```
| **This function is deprecated.**   
|
| Use[VideoSize](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize#VideoSize(int,int,float))instead.`
unappliedRotationDegrees`is not needed on API 21+ and is always zero.  

## Public functions

### equals

```
fun equals(obj: Any?): Boolean
```  

### fromBundle

```
@UnstableApi
java-static fun fromBundle(bundle: Bundle!): VideoSize!
```

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

### hashCode

```
fun hashCode(): Int
```  

### toBundle

```
@UnstableApi
fun toBundle(): Bundle!
```  

## Public properties

### height

```
val height: @IntRange(from = 0) Int
```

The video height in pixels, 0 when unknown.  

### pixelWidthHeightRatio

```
val pixelWidthHeightRatio: @FloatRange(from = 0, fromInclusive = false) Float
```

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

```
val unappliedRotationDegrees: @IntRange(from = 0, to = 359) Int
```
| **This property is deprecated.**   
|
Rotation is handled internally by the player, so this is always zero.  

### width

```
val width: @IntRange(from = 0) Int
```

The video width in pixels, 0 when unknown.