Setting initial playback time

Hi,

Just wanted to check if you have any recommended way to initialize a new playback session for an ImageViewerControl back in time.

As it is now I first create my playbackcontroller and set my desired playback time.

private FQID CreatePlaybackController()
{
var fqid = ClientControl.Instance.GeneratePlaybackController();
var message =new Message(MessageId.System.ModeChangeCommand, IsLive ? Mode.ClientLive : Mode.ClientPlayback), playbackControllerFQID);
 
EnvironmentManager.Instance.SendMessage(message, playbackControllerFQID);
_receiver = EnvironmentManager.Instance.RegisterReceiver(PlaybackTimeChangedHandler, new MessageIdFilter(MessageId.SmartClient.PlaybackCurrentTimeIndication));         return fqid;
}
var data = new PlaybackCommandData { Command = PlaybackData.Goto, DateTime = dateTime.ToUniversalTime() };
 
var message = new Message(MessageId.SmartClient.PlaybackCommand, data));
 
EnvironmentManager.Instance.SendMessage(message, PlaybackControllerFQID);

When I then instantiate my ImageViewerControl and attach the playbackControllerFQID to it the playback is still positioned at current time. I hoped that the playbackcontroller would still point at my desired playback time and the ImageViewerControl would show video from then.

ImageViewerControl.CameraFQID = item.FQID;
ImageViewerControl.Initialize();
ImageViewerControl.Connect();
 
ImageViewerControl.PlaybackControllerFQID = playbackControllerFQID;

Do I always have to update the playback position after I attach the playback controller to the ImageViewerControl? Am I doing things in the wrong order?

Best regards, Ola Nygren

You need to change the order. You must have the ImageViewerControl associated with the PlaybackControl before you send the Goto.

Thank you for responding so quickly. This was just the info I needed.