Reputation: 13982
I want to get the date of creation of a video file, commonly known as Media Created property (not to be confused with the File Creation Date)
I'm trying with this code:
var clip = await MediaClip.CreateFromFileAsync(x);
var encodingProps = clip.GetVideoEncodingProperties();
var props = encodingProps.Properties.ToList();
Inside the props
reference I'm getting a list of Guids and values, but I'm lost there.
Upvotes: 2
Views: 1761
Reputation: 39082
You can use Extended properties to get the specific property you need:
var dateEncodedPropertyName = "System.Media.DateEncoded";
var propertyNames = new List<string>()
{
dateEncodedPropertyName
};
// Get extended properties
IDictionary<string, object> extraProperties =
await file.Properties.RetrievePropertiesAsync(propertyNames);
// Get the property value
var propValue = extraProperties[dateEncodedPropertyName];
if (propValue != null)
{
Debug.WriteLine(propValue);
}
Note I am using the System.Media.DateEncoded
property in the example. If you need a different property, check out the full list of supported properties with their exact names in documentation.
Upvotes: 4