Tutorial 9 – Playback Control

Requirements:
Tutorial 8 – Browsing Video


In the previous tutorial, we showed how AxAuga’s built-in video browse functionality could be enabled.

In this tutorial, we’ll show how to use AxAuga’s playback controls programmatically. First, let’s setup a 2×1 display using “vport” and “salvo”. Here’s our Windows Form Shown:

We can use a AxAuga to directly control the speed and direction of the video. Let’s start by just pausing viewport 0:

The above code will execute 15 seconds after the display layout has been loaded. After 15 seconds, we call AxAuga’s PauseVideo method, which takes the viewport ID to pause. Let’s store the viewport time for the paused viewport for later use:

AxAuga’s method GetViewportTime takes the viewport ID for the viewport time to get. The viewport time comes back in string that is easily convertible to a DateTime. We can use this DateTime to as a reference point to seek back to later on. After the 3 second sleep has elapsed, our current viewport time is now around 3 seconds behind live, so let’s start playing from there:

AxAuga’s method StartAutoplay takes the viewport ID to play, a direction, and a multiplier for the speed. The direction parameter can either be 1 for forward or -1 for backward. The multiplier for speed is a positive value representing number milliseconds to be played per second, meaning if we’d like to play at 0.5x, for example, then our multiplier would be 500. For this example we’d like to play at 1x, so the multiplier should be 1000. Next, play backwards at 2x, wait for a bit, then pause:

As noted above, to play backwards we give StartAutoPlay -1 for the direction, and 2000 for the multiplier to play backwards at 2x. Now, we’ll do some single frame stepping:

AxAuga’s method MoveNext takes a viewport ID to frame step forward one frame. Notice that we used MoveNext while paused. We did this because MoveNext will not change the playback state of the video, meaning if we were still playing backwards at 2x before using MoveNext, then we would still be playing backwards at 2x after MoveNext. Pausing allows us to show frame stepping more easily. Let’s frame step backwards now:

AxAuga’s method MovePrev takes a viewport ID to frame step backward one frame. Remember when we stored off viewport 0’s time after the initial pause? Well, let’s use that DateTime to jump back to where we started:

AxAuga’s method Goto takes a viewport ID, the year, month, day, hour, minute, second, and millisecond all as short and all in UTC or universal time, which is why we convert the DateTime from local time to UTC. Now we’ll fast forward to catch up to live:

To play forward at 32x, we give StartAutoplay 1 for the direction and 32000 for the multiplier. Note that we’re not too far behind live after the Goto, so playing at 32x for around 3 seconds should run us up against live video. However, it won’t switch to live mode; instead it stays in playback mode, stalling for more video. Here’s how to switch to live mode:

AxAuga’s method LiveVideo takes a viewport ID to switch to live video. Once live video is switched to it starts to automatically play.

Screenshots of the final program:
Series-1-Tutorial-9-2
Series-1-Tutorial-9-1

That’s it. You now can use AxAuga’s programmatic playback controls to build your own user experience.