locked
How can I config a WinRT component when using msInsertVideoEffect?? RRS feed

  • Question

  • When I transform a MFT to a WinRT component and plugin it with function msInsertVideoEffect. Because I can't get the instance, how could I pass the parameters for configuration with interface IInspectable?? If Javascript can't do this, does any way to do this with other programming language??

    Monday, October 24, 2011 1:51 PM

Answers

  • Kenny,

    The MediaPlugins sample shows how to configure an effect:

    in CustomEfect.js, see the function:

    function getPolarEffectStartFunc(effectName) {
    return function () {
    // Set video element's source
    var vid = WinJS.Utilities.query("#customEffectVideo")[0],
    src = null;

    if (vid.readyState !== 0) {
    src = vid.src;
    }
    vid.pause();
    // Installing video effect with configuration in property set.
    var effect = new Windows.Foundation.Collections.PropertySet();
    effect["effect"] = effectName;
    vid.msClearEffects();
    vid.msInsertVideoEffect("Microsoft.Samples.PolarEffect", true, effect);
    if (src) {
    vid.src = src;
    } else {
    sdkSample.pickMediaFile([".mp4", ".wmv", ".avi"], [vid]);
    }
    };
    }

    This allows you to set that property.

     

    -Jeff


    Jeff Sanders (MSFT)
    Monday, October 24, 2011 7:43 PM
    Moderator
  • Hi Kenny,

    Your object should implement Windows.Media.IMediaExtension.  Then when you pass the propertyset (like in the sample) the SetProperty() method will be called.

    -Jeff


    Jeff Sanders (MSFT)
    • Marked as answer by Kenny Lin Wednesday, October 26, 2011 1:53 AM
    Tuesday, October 25, 2011 1:31 PM
    Moderator

All replies

  • Kenny,

    The MediaPlugins sample shows how to configure an effect:

    in CustomEfect.js, see the function:

    function getPolarEffectStartFunc(effectName) {
    return function () {
    // Set video element's source
    var vid = WinJS.Utilities.query("#customEffectVideo")[0],
    src = null;

    if (vid.readyState !== 0) {
    src = vid.src;
    }
    vid.pause();
    // Installing video effect with configuration in property set.
    var effect = new Windows.Foundation.Collections.PropertySet();
    effect["effect"] = effectName;
    vid.msClearEffects();
    vid.msInsertVideoEffect("Microsoft.Samples.PolarEffect", true, effect);
    if (src) {
    vid.src = src;
    } else {
    sdkSample.pickMediaFile([".mp4", ".wmv", ".avi"], [vid]);
    }
    };
    }

    This allows you to set that property.

     

    -Jeff


    Jeff Sanders (MSFT)
    Monday, October 24, 2011 7:43 PM
    Moderator
  • Thanks for replying, but I still have a question. How the component get the value of the property set?? Does My MFT class need to inherit the interface IPropertyset and implement it or ??
    Tuesday, October 25, 2011 2:44 AM
  • Hi Kenny,

    Your object should implement Windows.Media.IMediaExtension.  Then when you pass the propertyset (like in the sample) the SetProperty() method will be called.

    -Jeff


    Jeff Sanders (MSFT)
    • Marked as answer by Kenny Lin Wednesday, October 26, 2011 1:53 AM
    Tuesday, October 25, 2011 1:31 PM
    Moderator