static async Task <(uint time, Space <byte> random)> WriteC1Async(Stream stream) { var writer = new AmfWriter(new byte[C1Length], EmptyContext); var random = RandomEx.GetBytes(RandomLength); var time = Ts.CurrentTime; writer.WriteByte(3); // rtmp version (constant 3) [c0] writer.WriteUInt32(time); // time [c1] writer.WriteUInt32(0); // zero [c1] writer.WriteBytes(random); // random bytes [c1] await stream.WriteAsync(writer.Span); writer.Return(); return(time, random); }