---
title: "hasMediaType(_:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturedevice/hasmediatype(_:)"
---

# hasMediaType(_:)

Returns a Boolean value that indicates whether the device captures media of a particular type.

## Declaration

```swift
func hasMediaType(_ mediaType: AVMediaType) -> Bool
```

## Parameters

- `mediaType`: A media type, such as doc://com.apple.avfoundation/documentation/AVFoundation/AVMediaType/video, doc://com.apple.avfoundation/documentation/AVFoundation/AVMediaType/audio, or doc://com.apple.avfoundation/documentation/AVFoundation/AVMediaType/muxed.

## Return Value

Return Value true if the device captures media of the specified type; otherwise, false.

## See Also

### Inspecting device characteristics

- [isVirtualDevice](avfoundation/avcapturedevice/isvirtualdevice.md)
- [constituentDevices](avfoundation/avcapturedevice/constituentdevices.md)
- [transportType](avfoundation/avcapturedevice/transporttype.md)
- [supportsSessionPreset(_:)](avfoundation/avcapturedevice/supportssessionpreset(_:).md)
