Windows.Storage.FileProperties.VideoProperties
December 9, 2020 ยท View on GitHub
-description
Provides access to the video-related properties of an item (like a file or folder).
-remarks
You can access a VideoProperties object asynchronously using the getVideoPropertiesAsync method from the Properties property of an item (like a file of folder), or synchronously using the VideoProperties property if it is available. You can get a VideoProperties object using any of the following methods and properties:
- StorageItemContentProperties.getVideoPropertiesAsync method, which can be accessed using the Properties property, if it is available.
- FileInformation.videoProperties property
- FolderInformation.videoProperties property
Note
Properties that are get or set using a property handler that is defined by another app (like Microsoft Word) may not be accessible. Instead, you can try to get these properties using a file query that is backed by the system index. For more information, see QueryOptions.
For more code samples about accessing properties, see the File access sample.
-examples
This example demonstrates how to retrieve properties of a file, including video properties like Year and Rating.
try
{
StorageFile file = rootPage.sampleFile;
if (file != null)
{
StringBuilder outputText = new StringBuilder();
// Get video properties
VideoProperties videoProperties = await file.Properties.GetVideoPropertiesAsync();
outputText.AppendLine("Year: " + videoProperties.Year);
outputText.AppendLine("Rating: " + videoProperties.Rating);
}
}
// Handle errors with catch blocks
catch (FileNotFoundException)
{
// For example, handle a file not found error
}
After GetVideoPropertiesAsync completes, videoProperties gets a VideoProperties object.
In the example, file contains a StorageFile that represents the file to retrieve properties for.
-see-also
StorageItemContentProperties.getVideoPropertiesAsync method, Windows.Storage.BulkAccess.FileInformation.videoProperties property, Windows.Storage.BulkAccess.FolderInformation.videoProperties property, Windows.Storage.BulkAccess.IStorageItemInformation.VideoProperties property