locked
InvalidCastException while saving media composition using SaveAsync() RRS feed

  • Question

  • I have developed a custom video effect using MFT. I have checked MSDN's Media extensions sample. In that "PolarTransform.PolarEffect" is applied with effect configuration. The config is in string. My effect is bit of complex so I have to implement a class for effect config. So my effect's configuration is not a primitive type but a custom class. 

    Now MediaComposition class has SaveAsync() & LoadAsync() method to save & load the composition to/from an XML format. I noticed if any effect config has primitive data type, SaveAsync() works, while in my case my custom effect has effect config as custom class, so it's throwing InvalidCastException at line SaveAsync(), probably the serialization is not working properly. So what's the efficient way to handle such case? Is it known bug or will I have to go for some alternative?

    PS: Please note I am not rendering the composition to file using RenderToFileAsync()

    PropertySet configuration = new PropertySet();
    configuration.Add("effect", MyCustomEffectObjectHere);
    
    objMediaClip.VideoEffectDefinitions.Add(new VideoEffectDefinition("activatableClassIdHere", configuration));

    Thursday, August 28, 2014 9:49 AM