示例#1
0
        public Task <TimeSpan> Seek(TimeSpan time, CancellationToken token)
        {
            if (!IsInitialized())
            {
                throw new InvalidOperationException();
            }

            return(thread.Factory.StartNew(() =>
            {
                var index = audioIdx;
                if (videoIdx != -1)
                {
                    index = videoIdx;
                }
                formatContext.Seek(index, time);
                return time;
            }, token));
        }
        public Task <TimeSpan> Seek(TimeSpan time, CancellationToken token)
        {
            if (!IsInitialized())
            {
                throw new InvalidOperationException();
            }

            return(thread.Factory.StartNew(() =>
            {
                var index = audioIdx;
                if (videoIdx != -1)
                {
                    index = videoIdx;
                }

                // Token cancelled only. Timeouts.. not yet checked.
                _operationMonitor.Start(token, true);
                formatContext.Seek(index, time);
                _operationMonitor.End();
                return time;
            }, token));
        }