Dela via


VideoProperties Class

Definition

Provides access to the video-related properties of an item (like a file or folder).

public ref class VideoProperties sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class VideoProperties final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class VideoProperties
Public NotInheritable Class VideoProperties
Inheritance
Object Platform::Object IInspectable VideoProperties
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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.

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:

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.

Properties

Bitrate

Gets the sum audio and video bitrate of the video.

Directors

Gets the directors of the video.

Duration

Gets the duration of the video.

Height

Gets the height of the video.

Keywords

Gets the collection of keywords associated with the video.

Latitude

Gets the latitude coordinate where the video was shot.

Longitude

Gets the longitude coordinate where the video was shot.

Orientation

Gets a VideoOrientation value that indicates how the video should be rotated to display it correctly.

Producers

Gets the producers of the video.

Publisher

Gets or sets the publisher of the video.

Rating

Gets or sets the rating associated with a video file.

Subtitle

Gets or sets the subtitle of the video.

Title

Gets or sets the title of the video.

Width

Gets the width of the video.

Writers

Gets the script writers for the video.

Year

Gets or sets the year that the video was shot or released.

Methods

RetrievePropertiesAsync(IIterable<String>)

Retrieves the specified properties associated with the item.

SavePropertiesAsync()

Saves all properties associated with the item.

SavePropertiesAsync(IIterable<KeyValuePair<String,Object>>)

Saves the specified properties and values associated with the item.

Applies to

See also