Skip to content

Add common video types to MediaTypeNames#124390

Open
Cryptoc1 wants to merge 1 commit intodotnet:mainfrom
Cryptoc1:feature/video-media-type-names
Open

Add common video types to MediaTypeNames#124390
Cryptoc1 wants to merge 1 commit intodotnet:mainfrom
Cryptoc1:feature/video-media-type-names

Conversation

@Cryptoc1
Copy link

This PR adds common video types to the System.Net.Mime.MediaTypeNames static class.

I (and I assume others) use the MediaTypeNames constants for validating file uploads in APIs, it would be useful to have video types included in the runtime.

Additionally, many of the types added are already supported by the MediaTypeMap.

Copilot AI review requested due to automatic review settings February 13, 2026 17:00
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Feb 13, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@Cryptoc1
Copy link
Author

@dotnet-policy-service agree

@ManickaP
Copy link
Member

Hey @Cryptoc1, thanks for the contribution. But this is a public API and all of those must go through the API review process: https://github.com/dotnet/runtime/blob/main/docs/project/api-review-process.md
Could you please file an issue with an API proposal first?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new Video nested static class to MediaTypeNames containing constants for common video MIME types. The additions complement existing media type categories (Application, Font, Image, Multipart, Text) and enable developers to use standardized video MIME type constants for file upload validation and content type handling in APIs.

Changes:

  • Added MediaTypeNames.Video class with 12 video format constants including container formats (MP4, WebM, Matroska, Ogg, QuickTime), codecs (AV1, H.264, H.265, VP8, VP9), and legacy formats (MPEG, MPV)

Comment on lines +169 to +207
/// <summary>Specifies the kind of video data in an email message attachment.</summary>
public static class Video
{
/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in AV1 format.</summary>
public const string Av1 = "video/av1";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in H.264 format.</summary>
public const string H264 = "video/h264";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in H.265 format.</summary>
public const string H265 = "video/h265";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in Matroska format.</summary>
public const string Matroska = "video/x-matroska";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in MP4 format.</summary>
public const string Mp4 = "video/mp4";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in MPEG format.</summary>
public const string Mpeg = "video/mpeg";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in MPV format.</summary>
public const string Mpv = "video/mpv";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in Ogg format.</summary>
public const string Ogg = "video/ogg";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in Quicktime format.</summary>
public const string Quicktime = "video/quicktime";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in VP8 format.</summary>
public const string Vp8 = "video/vp8";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in VP9 format.</summary>
public const string Vp9 = "video/vp9";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in WebM format.</summary>
public const string Webm = "video/webm";
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new Video class needs to be added to the reference assembly at src/libraries/System.Net.Mail/ref/System.Net.Mail.cs. The reference assembly defines the public API surface and must be kept in sync with the implementation. Without this update, the new Video class will not be part of the public API contract.

Copilot uses AI. Check for mistakes.
/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in Ogg format.</summary>
public const string Ogg = "video/ogg";

/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in Quicktime format.</summary>
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format name should be "QuickTime" with a capital T, as it is the proper capitalization of Apple's QuickTime media framework. This follows the pattern of using proper capitalization for product/format names as seen elsewhere in the file (e.g., "Portable Document Format", "Rich Text Format").

Suggested change
/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in Quicktime format.</summary>
/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in QuickTime format.</summary>

Copilot uses AI. Check for mistakes.
Comment on lines +190 to +191
/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in MPV format.</summary>
public const string Mpv = "video/mpv";
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MIME type "video/mpv" is not registered in the IANA media types registry. This may be a non-standard or incorrect MIME type. Please verify if this is the intended MIME type or if it should be a different type (e.g., "video/mpeg" for MPEG video files). Standard video MIME types are registered with IANA and should be used to ensure compatibility.

Suggested change
/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is in MPV format.</summary>
public const string Mpv = "video/mpv";
/// <summary>Specifies that the <see cref="MediaTypeNames.Video"/> data is MPEG video commonly stored in files with an .mpv extension.</summary>
public const string Mpv = Mpeg;

Copilot uses AI. Check for mistakes.
@Cryptoc1
Copy link
Author

@ManickaP Apologies for not properly following the process; I have created an API Proposal here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants