protected virtual void OnTick(object o, TickArgs args) { long currentTime = args.CurrentTime; float currentposition = args.CurrentPosition; long streamLength = args.StreamLength; //Console.WriteLine ("Current Time:{0}\n Length:{1}\n",currentTime, streamLength); if (length != streamLength) { length = streamLength; slength = TimeString.MSecondsToSecondsString(length); } if (InSegment()) { currentTime -= segmentStartTime; currentposition = (float)currentTime / (float)(segmentStopTime - segmentStartTime); slength = TimeString.MSecondsToMSecondsString(segmentStopTime - segmentStartTime); } timelabel.Text = TimeString.MSecondsToMSecondsString(currentTime) + "/" + slength; timescale.Value = currentposition; if (Tick != null) { Tick(o, args.CurrentTime, args.StreamLength, args.CurrentPosition, args.Seekable); } }
private void SeekFromTimescale(double pos) { if (InSegment()) { long seekPos = segmentStartTime + (long)(pos * (segmentStopTime - segmentStartTime)); seeker.Seek(SeekType.Keyframe, GetRateFromScale(), true, seekPos); timelabel.Text = TimeString.MSecondsToMSecondsString(seekPos) + "/" + TimeString.MSecondsToMSecondsString(segmentStopTime - segmentStartTime); } else { seeker.Seek(SeekType.Keyframe, GetRateFromScale(), true, (int)(pos * length)); timelabel.Text = TimeString.MSecondsToMSecondsString(player.CurrentTime) + "/" + slength; Rate = 1; } }