CSharpRTMP.Common.MediaFile.SeekTo C# (CSharp) Method

SeekTo() public method

public SeekTo ( long p ) : bool
p long
return bool
        public bool SeekTo(long p)
        {
            try
            {
                DataStream.Seek(p, SeekOrigin.Begin);
            }
            catch (Exception ex)
            {
                Logger.FATAL($"Unable to seek to position {p} {ex.Message}");
                return false;
            }
            return true;
        }

Usage Example

 public virtual bool BuildFrame(MediaFile file, MediaFrame mediaFrame, Stream buffer)
 {
     if (!file.SeekTo((long)mediaFrame.Start))
     {
         FATAL("Unable to seek to position {0}", mediaFrame.Start);
         return false;
     }
     //3. Read the data
     file.DataStream.CopyPartTo(buffer, (int)mediaFrame.Length);
     buffer.Position = 0;
     return true;
 }
All Usage Examples Of CSharpRTMP.Common.MediaFile::SeekTo