Octopus
Octopus

Reputation: 801

How to save System.Media.DateEncoded in UWP video StorageFile

For a given StorageFile, named file, I can retrieve some properties by calling

await file.Properties.RetrievePropertiesAsync(propertiesToRetrieve)

Change them and save them properly

await file.Properties.SaveProperties(propertiesToSave)

However, I am getting a The method or operation is not implemented error in a try/catch block whenever I try to save the System.Media.DateEncoded property to a video file (MP4 and MOV), but i can read them without problem.

Is there a way to save such a property with the current API?

Thank you

Added Info

The DateTimeOffset comes from a DatePicker combined with a Timepicker, and it is injected in in a function similar to the one below. To simplify the code, I use below a hardcoded value for the DateTimeOffset. The exception is still thrown with the same message. I guarantee on my side that file is not null (not shown).

    public async Task<bool> SaveDateEncoded(StorageFile file)
    {
        try
        {
            var dateTimeOffset = new DateTimeOffset(2000, 09, 03, 3, 50, 13, new TimeSpan(2, 0, 0));
            var props = new List<KeyValuePair<string, object>>()
            {
                        new KeyValuePair<string, object>("System.Media.DateEncoded",dateTimeOffset),
            };
            await file.Properties.SavePropertiesAsync(props);
            return true;
        }
        catch (Exception ex)
        {

            return false;
        }
    }

Upvotes: 0

Views: 382

Answers (1)

Faywang - MSFT
Faywang - MSFT

Reputation: 5868

I am getting a The method or operation is not implemented error

This issue is fixed in Version 1903,1909.

Please see:

February 27, 2020—KB4535996 (OS Builds 18362.693 and 18363.693)

https://support.microsoft.com/en-us/help/4535996/windows-10-update-kb4535996

Addresses an issue with editing the properties of .mov files.

So you can install KB4535996 on your 1903/1909 machine and the issue will be resolved.

Upvotes: 1

Related Questions