using MessageId.SmartClient.PlaybackCommand

Hey

I create a plugin base on the SDK Plugin example 'Smart Client View and Window Tool’ - ‘Playback Control’

In the while loop on file BackgroundPlugin.cs I add the a function that send the playback control massage -

           _EnvironmentManager.Instance.SendMessage(_

           _new VideoOS.Platform.Messaging.Message(_

               _MessageId.SmartClient.PlaybackCommand,_

               _new PlaybackCommandData()_

               _{_

                   _Command = command,_

                   _DateTime = dateTime,_

                   _Speed = speed_

               _}));_

I succeed to change from PlayForward to PlayReverse and etc.

But when I try to change the speed (for example from PlayForward x2 to PlayForward x5) I got exception

Way it’s happened ?

Thank you

This is the exception info:

************** Inner Exception **************

Exception type:System.InvalidOperationException

Exception message:The calling thread cannot access this object because a different thread owns it.

Exception source:WindowsBase

Exception Target Site: VerifyAccess

at System.Windows.Threading.Dispatcher.VerifyAccess()

at System.Windows.DependencyObject.GetValue(DependencyProperty dp)

at System.Windows.Controls.Primitives.ToggleButton.get_IsChecked()

at VideoOS.UI.Common.WPF.Timeline.Control.ControlsArea.Controls.PlaybackSpeedControl.set_PlaybackSpeed(PlaybackSpeed value)

at VideoOS.UI.Common.WPF.Timeline.Control.ControlsArea.ControlsArea.ApplyAppearanceAndBehaviourControllerProperty(String propertyName)

at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)

at VideoOS.UI.Common.WPF.Timeline.Control.Controllers.AppearanceAndBehaviourController.OnPropertyChanged(Enum fieldName)

at VideoOS.UI.Common.WPF.Timeline.Control.Controllers.AppearanceAndBehaviourController.set_PlaybackSpeed(PlaybackSpeed value)

at VideoOS.UI.Common.WPF.Timeline.Control.TimelineControl.set_PlaybackSpeed(Double value)

at VideoOS.RemoteClient.Application.UI.Timeline.SmartClientTimelineHelper.BrowseController_PlaybackSpeedChangedEvent(Object sender, PlaybackSpeedEventArgs e)

at System.EventHandler`1.Invoke(Object sender, TEventArgs e)

at VideoOS.RemoteClient.Application.Controllers.BrowseController.FirePlaybackSpeedChangedEvent(PlaybackSpeedEventArgs e)

at VideoOS.RemoteClient.Application.Controllers.BrowseController.SetPlaybackSpeed(Double playbackSpeed, Boolean isFromLocalSource)

************** Outer Exception **************

Exception type:System.Reflection.TargetInvocationException

Exception message:Exception has been thrown by the target of an invocation.

Exception source:mscorlib

Exception Target Site: InvokeMethod

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

at VideoOS.RemoteClient.Application.Actions.ActionBase.InvokeAction(Object[] parameters)

at VideoOS.RemoteClient.Application.MIP.Manager.MessageManager.ClientPlaybackCommandHandler(Message message, FQID dest, FQID source)

at VideoOS.RemoteClient.Application.MIP.Manager.SCEnvironmentManager.ExecuteMessage(Message message, FQID destination, FQID sender, String logMessage)

My first idea is that this message must be sent while being on the UI thread. In an Smart Client plugin you can achieve this by using:

virtual void VideoOS.Platform.ClientControl.CallOnUiThread ( Action actionToBeInvoked)

ref. https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_client_control.html&tree=tree_search.html?search=callonuithread

Let me know if my idea is correct and this solves it..

Hey

Thank you!!!

You right

It’s working!