Live Production Software Forums

Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Sunday, March 17, 2013 4:34:58 PM(UTC)

Rank: Newbie

Groups: Registered
Joined: 3/17/2013(UTC)
Posts: 1
Location: Serbia

Thanks: 1 times

I created a xaml file with some text objects and one image object. I want to change image in this image object using vMix API. Is there any function in vMix API which I can use to do that?

#2 Posted : Monday, March 18, 2013 3:13:38 PM(UTC)

Rank: Member

Groups: Registered
Joined: 3/11/2013(UTC)
Posts: 26

Thanks: 1 times
Was thanked: 9 time(s) in 6 post(s)
vMix doesn't provide a callable API, but instead provides an Interface, which you can implement in your XAML codebehind.

Reference C:\Program Files\vMix\vMixInterop.dll, then have your class implement vMixWPFUserControl:

namespace vMix {
  using vMixInterop;

  public partial class UserControl1 : UserControl, vMixWPFUserControl, INotifyPropertyChanged {

There are eight methods, of which two return a TimeSpan, and must be implemented (GetDuration and GetPosition). The other six return a void, so implementation is optional. Here's a summary of the eight methods:

Close() : Called when the Close button is clicked. Close your properties window.
GetDuration() : Called twice per second for each window (once for Preview, and again for Output). Return the duration of your animation, or TimeSpan.Zero if none.
GetPosition() : Called every second for each window (once for Preview, and again for Output). Return the current "position in time" of your animation, TimeSpan.Zero if none.
Load(int width, int height) : Called after your constructor. Stash the width and height in member variables if you need them.
Pause() : Called when: (a) Pause is clicked, (b) Auto Pause with Transition is true, or (c) Position equals Duration. Set your "m_running" member variable to false.
Play() : Called when: (a) Play is clicked, or (b) Auto Play with Transition is true. Set your "m_running" member variable to true.
SetPosition(TimeSpan position) : Called when: (a) Restart is clicked, (b) Auto Restart with Transition is true, or (c) User is scrubbing the control. Update your "m_position" variable.
ShowProperties() : Called when "XAML Properties" is clicked. Show a Windows Form properties window.

If you want to change your image based on user input, implement a Windows Form for a "Properties" window, and show it in the ShowProperties() method:

Reference System.Windows.Forms

namespace vMix {
  using System.Windows.Forms;

  public partial class Form1 : Form {
    private UserControl1 m_parent;

    public Form1(UserControl1 parent) {
      m_parent = parent;
      TopMost = true;

If you want to change your image based on the DirectShow clock reference, use the GetPosition() method to: (a) update your current "position in time", and (b) update the ImageSource property that your Image control Source property is bound to.

thanks 1 user thanked jwolthuis for this useful post.
Zeljko on 3/18/2013(UTC)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.