/// <summary> /// This is the click handler for the 'OpenGrayscale' button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OpenGrayscale_Click(object sender, RoutedEventArgs e) { outputVideo.RemoveAllEffects(); outputVideo.AddVideoEffect("GrayscaleTransform.GrayscaleEffect", true, null); rootPage.PickSingleFileAndSet(new string[] { ".mp4", ".wmv", ".avi" }, outputVideo); }
/// <summary> /// Add a Ryken.Video.Effects.VideoEffect to the the MediaElement /// </summary> /// <param name="mediaElement">The MediaElement to add the effect to</param> /// <param name="id">The ID to use for this effect to frames can be processed by IVideoHandler</param> /// <param name="properties">Additional properties that will be passed to IVideoEffectHandler implementations registered with the provided ID. Can be null.</param> public static void AddVideoEffect(MediaElement mediaElement, string id, IPropertySet properties) { if (mediaElement == null) { throw new ArgumentNullException(nameof(mediaElement)); } if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentException("Effect ID not set", nameof(id)); } if (properties == null) { properties = new PropertySet(); } if (!properties.ContainsKey(IDKey)) { properties.Add(IDKey, id); } mediaElement.AddVideoEffect(typeof(VideoEffect).FullName, false, properties); }
/// <summary> /// This is the click handler for the 'Open' button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Open_Click(object sender, RoutedEventArgs e) { outputVideoStabilized.RemoveAllEffects(); outputVideoStabilized.AddVideoEffect(Windows.Media.VideoEffects.VideoStabilization, true, null); rootPage.PickSingleFileAndSet(new string[] { ".mp4", ".wmv", ".avi" }, outputVideo, outputVideoStabilized); }