Gets or sets the current position, relative to the total duration of the media, in seconds.
public virtual double CurrentPosition {get; set;} Public Overridable Property CurrentPosition As Double A value representing the current playback position.
This property is the current position that playback has reached. The value ignores the playback rate and start time. For example, if the rate is set to 2.0 and the start time to 5 seconds, playing the media for 4 seconds yields a current position of 9.0 seconds (5 + 4 x 2.0). If the media is paused or stopped, the current position is the point at which playback will resume. Call CheckSeekingCapabilities to determine whether PlaySeeking.Forward and PlaySeeking.Backward are enabled. For more information, refer to the PlaySeeking enumeration.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public PlayCtrlForm _form = new PlayCtrlForm();double _duration = 0.0;double _currentPos = -1;public void PlayExample(){// reference the play controlPlayCtrl playctrl = _form.PlayCtrl;// input filestring inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi");try{// set autostart to falseplayctrl.AutoStart = false;// set the play count to 2playctrl.PlayCount = 2;// set our source media fileplayctrl.SourceFile = inFile;// get the reported duration_duration = playctrl.Duration;// set the playback rate to 2xif (playctrl.IsRateSupported(2.0))playctrl.Rate = 2.0;// set event handler to get tracking position changesplayctrl.TrackingPositionChanged += new TrackingPositionChangedEventHandler(PlayCtrl_TrackingPositionChanged);// run it!playctrl.Run();}catch (Exception){_result = false;}// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while (playctrl.State == PlayState.Running)Application.DoEvents();// set the result to determine if the reported duration// is the same as the final position from tracking_result = (_duration == _currentPos && _duration > 0.0);}void PlayCtrl_TrackingPositionChanged(object sender, TrackingPositionChangedEventArgs e){// get the frame and tracking positions for demonstration onlyint frame = _form.PlayCtrl.CurrentFramePosition;int tracking = _form.PlayCtrl.CurrentTrackingPosition;// get the current position_currentPos = Math.Max(_currentPos, _form.PlayCtrl.CurrentPosition);}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As PlayCtrlForm = New PlayCtrlForm()Private _duration As Double = 0.0Private _currentPos As Double = -1Public Sub PlayExample()' reference the play controlDim playctrl As PlayCtrl = _form.PlayCtrl' input fileDim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")Try' set autostart to falseplayctrl.AutoStart = False' set the play count to 2playctrl.PlayCount = 2' set our source media fileplayctrl.SourceFile = inFile' get the reported duration_duration = playctrl.Duration' set the playback rate to 2xIf playctrl.IsRateSupported(2.0) Thenplayctrl.Rate = 2.0End If' set event handler to get tracking position changesAddHandler playctrl.TrackingPositionChanged, AddressOf PlayCtrl_TrackingPositionChanged' run it!playctrl.Run()Catch e1 As Exception_result = FalseEnd Try' we'll loop on the state and pump messages for this example.' but you should not need to if running from a Windows Forms application.Do While playctrl.State = PlayState.RunningApplication.DoEvents()Loop' set the result to determine if the reported duration' is the same as the final position from tracking_result = (_duration = _currentPos AndAlso _duration > 0.0)End SubPrivate Sub PlayCtrl_TrackingPositionChanged(ByVal sender As Object, ByVal e As TrackingPositionChangedEventArgs)' get the frame and tracking positions for demonstration onlyDim frame As Integer = _form.PlayCtrl.CurrentFramePositionDim tracking As Integer = _form.PlayCtrl.CurrentTrackingPosition' get the current position_currentPos = Math.Max(_currentPos, _form.PlayCtrl.CurrentPosition)End SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"End Class
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public PlayCtrlForm _form = new PlayCtrlForm();double _duration = 0.0;double _currentPos = -1;public void PlayExample(){// reference the play controlPlayCtrl playctrl = _form.PlayCtrl;// input filestring inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi");try{// set autostart to falseplayctrl.AutoStart = false;// set the play count to 2playctrl.PlayCount = 2;// set our source media fileplayctrl.SourceFile = inFile;// get the reported duration_duration = playctrl.Duration;// set the playback rate to 2xif (playctrl.IsRateSupported(2.0))playctrl.Rate = 2.0;// set event handler to get tracking position changesplayctrl.TrackingPositionChanged += new TrackingPositionChangedEventHandler(PlayCtrl_TrackingPositionChanged);// run it!playctrl.Run();}catch (Exception){_result = false;}// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while (playctrl.State == PlayState.Running)Application.DoEvents();// set the result to determine if the reported duration// is the same as the final position from tracking_result = (_duration == _currentPos && _duration > 0.0);}void PlayCtrl_TrackingPositionChanged(object sender, TrackingPositionChangedEventArgs e){// get the frame and tracking positions for demonstration onlyint frame = _form.PlayCtrl.CurrentFramePosition;int tracking = _form.PlayCtrl.CurrentTrackingPosition;// get the current position_currentPos = Math.Max(_currentPos, _form.PlayCtrl.CurrentPosition);}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As PlayCtrlForm = New PlayCtrlForm()Private _duration As Double = 0.0Private _currentPos As Double = -1Public Sub PlayExample()' reference the play controlDim playctrl As PlayCtrl = _form.PlayCtrl' input fileDim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")Try' set autostart to falseplayctrl.AutoStart = False' set the play count to 2playctrl.PlayCount = 2' set our source media fileplayctrl.SourceFile = inFile' get the reported duration_duration = playctrl.Duration' set the playback rate to 2xIf playctrl.IsRateSupported(2.0) Thenplayctrl.Rate = 2.0End If' set event handler to get tracking position changesAddHandler playctrl.TrackingPositionChanged, AddressOf PlayCtrl_TrackingPositionChanged' run it!playctrl.Run()Catch e1 As Exception_result = FalseEnd Try' we'll loop on the state and pump messages for this example.' but you should not need to if running from a Windows Forms application.Do While playctrl.State = PlayState.RunningApplication.DoEvents()Loop' set the result to determine if the reported duration' is the same as the final position from tracking_result = (_duration = _currentPos AndAlso _duration > 0.0)End SubPrivate Sub PlayCtrl_TrackingPositionChanged(ByVal sender As Object, ByVal e As TrackingPositionChangedEventArgs)' get the frame and tracking positions for demonstration onlyDim frame As Integer = _form.PlayCtrl.CurrentFramePositionDim tracking As Integer = _form.PlayCtrl.CurrentTrackingPosition' get the current position_currentPos = Math.Max(_currentPos, _form.PlayCtrl.CurrentPosition)End SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"End Class
|
Products |
Support |
Feedback: CurrentPosition Property - Leadtools.Multimedia |
Introduction |
Help Version 19.0.2017.6.16
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.