Video​Properties Video​Properties Video​Properties Video​Properties Class

Definition

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

public : sealed class VideoProperties : IStorageItemExtraProperties, IVideoPropertiespublic sealed class VideoProperties : IStorageItemExtraProperties, IVideoPropertiesPublic NotInheritable Class VideoProperties Implements IStorageItemExtraProperties, IVideoProperties// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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
}

var file = SdkSample.sampleFile;
if (file !== null) {
    var outputDiv = document.getElementById("output");

    // Get video properties
    file.properties.getVideoPropertiesAsync().done(function (videoProperties) {
        outputDiv.innerHTML += "Year: " + videoProperties.year + "<br/>";
        outputDiv.innerHTML += "Rating: " + videoProperties.rating + "<br/>";
    },
    // Handle errors with an error function
    function (error) {
       // Handle errors encountered while retrieving properties
    });
}

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 Bitrate Bitrate Bitrate

Gets the sum audio and video bitrate of the video.

public : unsigned short Bitrate { get; }public uint Bitrate { get; }Public ReadOnly Property Bitrate As uint// You can use this property in JavaScript.
Value
unsigned short uint uint uint

The video's sum audio and video bitrate.

Directors Directors Directors Directors

Gets the directors of the video.

public : IVector<string> Directors { get; }public IList<string> Directors { get; }Public ReadOnly Property Directors As IList<string>// You can use this property in JavaScript.
Value
IVector<PlatForm::String> IList<string> IList<string> IList<string>

A list of the names of the video's directors.

Remarks

This property is read-only. It returns a collection, and you can't delete or replace the collection itself. The contents of the collection, however, are not read-only. You can add items to the collection, remove items from the collection, and change existing items in the collection. Call the SavePropertiesAsync method of the parent class to save the updated contents of the collection.

Duration Duration Duration Duration

Gets the duration of the video.

public : TimeSpan Duration { get; }public TimeSpan Duration { get; }Public ReadOnly Property Duration As TimeSpan// You can use this property in JavaScript.
Value
TimeSpan TimeSpan TimeSpan TimeSpan

The duration.

Height Height Height Height

Gets the height of the video.

public : unsigned short Height { get; }public uint Height { get; }Public ReadOnly Property Height As uint// You can use this property in JavaScript.
Value
unsigned short uint uint uint

The height of the video, in pixels.

Keywords Keywords Keywords Keywords

Gets the collection of keywords associated with the video.

public : IVector<string> Keywords { get; }public IList<string> Keywords { get; }Public ReadOnly Property Keywords As IList<string>// You can use this property in JavaScript.
Value
IVector<PlatForm::String> IList<string> IList<string> IList<string>

The collection of keywords.

Remarks

This property is read-only, similar to the Directors property.

Latitude Latitude Latitude Latitude

Gets the latitude coordinate where the video was shot.

public : IReference<double> Latitude { get; }public Nullable<double> Latitude { get; }Public ReadOnly Property Latitude As Nullable<double>// You can use this property in JavaScript.
Value
IReference<double> Nullable<double> Nullable<double> Nullable<double>

The latitude coordinate where the video was shot.

The system computes this coordinate using the following file properties:

Remarks

To set the latitude or longitude of the video, you must set all four of the file properties that are used to compute the latitude or longitude coordinates.

For code examples that demonstrate working with Latitude, Longitude and their underlying file properties, see the Simple imaging sample.

Longitude Longitude Longitude Longitude

Gets the longitude coordinate where the video was shot.

public : IReference<double> Longitude { get; }public Nullable<double> Longitude { get; }Public ReadOnly Property Longitude As Nullable<double>// You can use this property in JavaScript.
Value
IReference<double> Nullable<double> Nullable<double> Nullable<double>

The longitude coordinate where the photo was taken.

The system computes this coordinate using the following file properties:

Orientation Orientation Orientation Orientation

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

public : VideoOrientation Orientation { get; }public VideoOrientation Orientation { get; }Public ReadOnly Property Orientation As VideoOrientation// You can use this property in JavaScript.
Value
VideoOrientation VideoOrientation VideoOrientation VideoOrientation

The value that indicates how the video should be rotated to display it correctly.

Producers Producers Producers Producers

Gets the producers of the video.

public : IVector<string> Producers { get; }public IList<string> Producers { get; }Public ReadOnly Property Producers As IList<string>// You can use this property in JavaScript.
Value
IVector<PlatForm::String> IList<string> IList<string> IList<string>

A list of the names of the video's producers.

Remarks

This property is read-only, similar to the Directors property.

Publisher Publisher Publisher Publisher

Gets or sets the publisher of the video.

public : PlatForm::String Publisher { get; set; }public string Publisher { get; set; }Public ReadWrite Property Publisher As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The name of the video's publisher.

Rating Rating Rating Rating

Gets or sets the rating associated with a video file.

public : unsigned short Rating { get; set; }public uint Rating { get; set; }Public ReadWrite Property Rating As uint// You can use this property in JavaScript.
Value
unsigned short uint uint uint

The media file rating, as a value between 0 and 99.

Remarks

The rating property for this media file type is obtained from the Windows file properties, specifically from System.Rating. System.Rating has a value from 0 to 99. A value of 0 indicates that the file has not been rated.

Rating info is often presented to the user as a “star” metaphor, where a star rating can be from 0 to 5 stars. This is shown as the outline of 5 star shapes, with the current rating indicated by a horizontal color bar within the 5 star shapes. For more info, see Guidelines for the Rating control.

For HTML UI, the Rating control implements a star-rating behavior, but you’ll have convert a Rating property value into the star-count values that the Rating control uses for its properties.

For XAML UI there is no default rating control in the Windows Runtime XAML vocabulary. However, several third-party control vendors have created a XAML rating control.

Here’s some suggested logic for converting the 0-99 possible value of a Rating property to an integer value between 0 and 5 that is suitable for a 5-star UI presentation metaphor, and for the Rating control: uint starRating = rating == 0 ? 0 : (uint)Math.Round((double)rating / 25.0) + 1;.

See Also

Subtitle Subtitle Subtitle Subtitle

Gets or sets the subtitle of the video.

public : PlatForm::String Subtitle { get; set; }public string Subtitle { get; set; }Public ReadWrite Property Subtitle As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The video's subtitle.

Title Title Title Title

Gets or sets the title of the video.

public : PlatForm::String Title { get; set; }public string Title { get; set; }Public ReadWrite Property Title As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The video's title.

Width Width Width Width

Gets the width of the video.

public : unsigned short Width { get; }public uint Width { get; }Public ReadOnly Property Width As uint// You can use this property in JavaScript.
Value
unsigned short uint uint uint

The width of the video, in pixels.

Writers Writers Writers Writers

Gets the script writers for the video.

public : IVector<string> Writers { get; }public IList<string> Writers { get; }Public ReadOnly Property Writers As IList<string>// You can use this property in JavaScript.
Value
IVector<PlatForm::String> IList<string> IList<string> IList<string>

A list of the names of the video's script writers.

Remarks

This property is read-only, similar to the Directors property.

Year Year Year Year

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

public : unsigned short Year { get; set; }public uint Year { get; set; }Public ReadWrite Property Year As uint// You can use this property in JavaScript.
Value
unsigned short uint uint uint

The video's release year.

Methods

RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>)

Retrieves the specified properties associated with the item.

public : IAsyncOperation<IMap<PlatForm::String, PlatForm::Object>> RetrievePropertiesAsync(IIterable<PlatForm::String> propertiesToRetrieve)public IAsyncOperation<IDictionary<string, object>> RetrievePropertiesAsync(IEnumerable<String> propertiesToRetrieve)Public Function RetrievePropertiesAsync(propertiesToRetrieve As IEnumerable<String>) As IAsyncOperation( Of IDictionarystring, object )// You can use this method in JavaScript.
Parameters
propertiesToRetrieve
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>

A collection that contains the names of the properties to retrieve.

Returns
IAsyncOperation<IMap<PlatForm::String, PlatForm::Object>> IAsyncOperation<IDictionary<string, object>> IAsyncOperation<IDictionary<string, object>> IAsyncOperation<IDictionary<string, object>>

When this method completes successfully, it returns a collection (type IMap ) that contains the specified properties and values as key-value pairs.

Remarks

In JavaScript, use then or done to specify handler functions that will capture and process the collection when it is returned.

SavePropertiesAsync() SavePropertiesAsync() SavePropertiesAsync() SavePropertiesAsync()

Saves all properties associated with the item.

public : IAsyncAction SavePropertiesAsync()public IAsyncAction SavePropertiesAsync()Public Function SavePropertiesAsync() As IAsyncAction// You can use this method in JavaScript.
Returns

No object or value is returned when this method completes.

Remarks

If any one of the property values is invalid, none of the values will be saved.

See Also

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

Saves the specified properties and values associated with the item.

public : IAsyncAction SavePropertiesAsync(IIterable<IKeyValuePair<PlatForm::String, PlatForm::Object>> propertiesToSave)public IAsyncAction SavePropertiesAsync(IEnumerable<KeyValuePair<String, Object>> propertiesToSave)Public Function SavePropertiesAsync(propertiesToSave As IEnumerable<KeyValuePair<String, Object>>) As IAsyncAction// You can use this method in JavaScript.
Parameters
propertiesToSave
IIterable<IKeyValuePair<PlatForm::String, PlatForm::Object>> IEnumerable<KeyValuePair<String, Object>> IEnumerable<KeyValuePair<String, Object>> IEnumerable<KeyValuePair<String, Object>>

A collection that contains the names and values of the properties to save as key-value pairs (type IKeyValuePair ).

Returns

No object or value is returned when this method completes.

See Also