Previous and Next frame Playback Commands not working

I have integrated Milestone VMS with some existing software. We have got everything working fine, the video loads, can switch from Live to Playback and we can send Playback commands Play, Pause, Seek, Rewind, Fast forward without any issues - all while supporting multiple players.

However, Playback commands Next and Previous do not work for frame to frame navigation.

// Start playback mode
_imageViewer.StartBrowse();
EnvironmentManager.Instance.PostMessage(
       new Message(MessageId.System.ModeChangeCommand, Mode.ClientPlayback),
_playbackFqid);
 
// Send pause command
SendPlaybackCommand(new PlaybackCommandData {Command = PlaybackData.PlayStop});
 
// Send Previous Frame command
SendPlaybackCommand(new PlaybackCommandData {Command = PlaybackData.Previous});
 
// Handle command
private void SendPlaybackCommand(PlaybackCommandData command)
{
    EnvironmentManager.Instance.PostMessage(
        new Message(MessageId.SmartClient.PlaybackCommand, command),
        _playbackFqid);
}

Pause command works fine. In both cases _playbackFqid is the same object, generated via ClientControl.Instance.GeneratePlaybackController(). Any ideas why PlaybackData.Next and PlaybackData.Previous commands are having a hard time functioning correctly?

Using SDK 12.1

WPF integrating via ImageViewerWpfControl

Referenced from Component Sample VideoViewer, which works fine.

I tried to reproduce but could not.

One suspicion is on timing, could you as an experiment introduce a small wait between each PostMessage (Thread.Sleep(100) )?

Let me know what you find doing this experiment.

Try to introduce -

bool VideoOS.Platform.EnvironmentManager.TracePlaybackDetails

[get, set]

Make deeper log entries for playback (MIPSDK 2016 - just for stand alone MIP Environment).

-in your code and review the MIP logs. Do you see errors or something suspicious?

Hi Bo,

Actually the commands are sent when a button is pressed, so it isn’t a timing issue. The pause command is only sent if the video is currently playing, if I pause it first, then I will effectively only be sending one command (Next or Previous)

When the Previous or Next button are clicked, I receive the following output in the MIP logs:

2018-07-10 14:00:02.572 Debug: PlaybackControllerBase ():PlaybackCommandHandler() Id=8e9b1107-493f-4f16-ae1e-11ec900c5e71Start - Previous( Play=Stop, PlaybackMode=Stop, Timer.Enabled=False)
 
2018-07-10 14:00:04.446 Debug: PlaybackControllerBase ():PlaybackCommandHandler() Id=8e9b1107-493f-4f16-ae1e-11ec900c5e71Start - Next( Play=Stop, PlaybackMode=Stop, Timer.Enabled=False)

Nothing suspicious in the other logs.

I’m also subscribing to a few events

General workflow:

Initialize stuff:

SdkEnvironment.Initialize(); // Initialize the standalone Environment
UiEnvironment.Initialize();

Some time later, hook up to PlaybackTimeChanged event:

EnvironmentManager.Instance.RegisterReceiver(PlaybackTimeChangedHandler,
    new MessageIdFilter(MessageId.SmartClient.PlaybackCurrentTimeIndication));
 

After creating the ImageViewerWpfControl and logging into the Milestone server:

_imageViewer.Disconnect();
 
// subscribe to events
_imageViewer.ImageDisplayed += ImageDisplayed;
_imageViewer.ConnectResponseReceived += ConnectResponseReceived;
 
// setup FQIDs
_imageViewer.CameraFQID = cameraFqid;
_imageViewer.PlaybackControllerFQID = _playbackFqid;
 
// setup player configuration
_imageViewer.EnableBrowseMode = true;
_imageViewer.EnableDigitalZoom = true;
_imageViewer.EnableMouseControlledPtz = false;
_imageViewer.EnableMousePtzEmbeddedHandler = false;
_imageViewer.EnableSetupMode = false;
_imageViewer.EnableVisibleCameraName = false;
_imageViewer.EnableVisibleHeader = false;
_imageViewer.EnableVisibleLiveIndicator = false;
_imageViewer.EnableVisibleTimestamp = false;
 
_imageViewer.Initialize();
_imageViewer.Connect();
 
StartLiveMode();

where StartLiveMode does

_imageViewer.StartLive();
EnvironmentManager.Instance.PostMessage(
                new Message(MessageId.System.ModeChangeCommand, Mode.ClientLive), _imageViewer.PlaybackControllerFQID);

Just keep in mind that all the other functions are working fine, the code is all the same for each function EXCEPT the PlaybackCommandData

sent via PostMessage. Specifically, passing PlaybackData.Next instead of a different command.

The data sent, is as follows:

Command	"Next"	string
DateTime	{1/01/0001 12:00:00 AM}	System.DateTime
Speed	0	double

where _playbackFqid & _imageViewer.PlaybackControllerFQID is

FolderType		No										VideoOS.Platform.FolderType
Kind			{f618e8da-e640-4646-9070-6bbc1277e533}	System.Guid
ObjectId		{8e9b1107-493f-4f16-ae1e-11ec900c5e71}	System.Guid
ObjectIdString	null									string
ParentId		{00000000-0000-0000-0000-000000000000}	System.Guid
ServerId		{VideoOS.Platform.ServerId}				VideoOS.Platform.ServerId

All the resources were taken from the MIPSKD 2018 R1 bin directory.

I’ve modified the PlaybackWpfUser component example to send PostMessage with PlaybackCommandData of PlaybackData.Next - It works fine, although this is with SDK version 2018 R2 instead of R1 which is where I sourced my DLL files.

I am glad you solved it.

Haha actually I haven’t solved it yet Bo. I am just trying to figure out what the difference is between the PlaybackWpfUser Component Example and the integration I have performed on our software. Our software still doesn’t receive any frame response from the server it seems.

Although I don’t know how much help you guys will be to us, as it looks like it is something I’m doing wrong. I’ll keep playing around and post back once we figure out the issue.

I’m just trying to make the example as close as possible to our integration, hopefully something will pop up that we missed.