首页 > 解决方案 > 无法使用 StorageItemContentProperties SavePropertiesAsync 在 MP4 文件中设置属性

问题描述

我正在尝试在 UWP 应用程序的 MP4 视频文件中设置一些属性。我能够毫无问题地检索扩展属性。但是,当我尝试修改和保存属性时,其中一些会导致应用程序失败。

我认为可以通过 Windows 资源管理器修改的任何属性也可以通过编程方式进行修改,但它不适用于我的代码。

我找到了可用于在 windows 属性页中检索和保存属性的不同参数。https://docs.microsoft.com/en-us/windows/win32/properties/props

我还检查了像这样的不同主题,并且我能够保存关键字等属性,但是当我尝试保存 Actors (ItemParticipants) 时它失败了。uwp StorageFile 添加自定义属性

这是我用来保存属性的代码

// The list of pair of key/values to pass in the retrieve or save properties
IDictionary<string, Object> PropertiesToSave = new Dictionary<string, Object>();

//Adding the property to save
PropertiesToSave.Add("System.ItemParticipants", myParticipantsList[]);  
PropertiesToSave.Add("System.Keywords", myKeywordsList[]);

//saving the properties
await video.Properties.SavePropertiesAsync(PropertiesToSave);

如果我只保存关键字,工作正常,但如果我保存 ItemParticipants 它会失败,即使我能够检索它们并且我也能够直接从 Windows 资源管理器中设置它们。

我如何知道可以为视频设置哪些 windows 属性?是否只能设置 VideoProperties 中的属性(表示为可设置)?

标签: c#uwpstoragefile

解决方案


推荐阅读