dotnet / dotnet/macios

AVAssetReaderOutput.MediaType returns string and not smart enum

Open
#16,318 4 comments 0 reactions 0 assignees View on GitHub
api-bindings enhancement
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 17h
Merged PRs (30d)
108

Description

### Steps to Reproduce

In Xamarin.iOS we could check for MediaType on a AVAssetTrack like so:

```csharp
if (track.MediaType == AVMediaType.Video)
// do something
```

[`AVMediaType`](https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avmediatype?view=xamarin-ios-sdk-12) is no longer available in `net6.0-ios` and seems like it has been replaced with the enum `AVMediaTypes`. However, using that for comparison does not work as MediaType does not directly map into that enum.

This example doesn't work in `net6.0-ios` as `MediaType` would return "vide" and not "Video".

```csharp
if (track.MediaType == AVMediaTypes.Video.ToString())
// do something
```

### Expected Behavior
AVMediaType static class being available for easy comparison with AVAssetTrack MediaType

### Actual Behavior
Not available and replaced with `AVMediaTypes` enum

### Environment

Version information

```
net6.0-ios

Installed Workload Ids Manifest Version Installation Source
---------------------------------------------------------------------
macos 12.3.454/6.0.400 SDK 6.0.400
ios 15.4.454/6.0.400 SDK 6.0.400
maccatalyst 15.4.454/6.0.400 SDK 6.0.400
maui 6.0.540/6.0.400 SDK 6.0.400
tvos 15.4.454/6.0.400 SDK 6.0.400
android 32.0.465/6.0.400 SDK 6.0.400
android-33 32.0.465/6.0.400 SDK 6.0.400
```

### Build Logs

### Example Project (If Possible)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.