 			var header:FLVHeader = new FLVHeader();
 			var headerBytes:ByteArray = new ByteArray();
 			header.write(headerBytes);
+			if(writeToMasterBuffer)
+				_masterBuffer.writeBytes(headerBytes);
 			appendBytes(headerBytes);
 			
 			// Initialize ourselves.


		public static function isTagAVCC(tag:FLVTagVideo):Boolean
		{
			// Must be keyframe.
			if(tag.frameType != FLVTagVideo.FRAME_TYPE_KEYFRAME)
				return false;

			// And config record.
			if(tag.avcPacketType == 0)
				return true;

			return false;
		}


		public static function isTagIFrame(tag:FLVTagVideo):Boolean
		{
			// Must be keyframe.
			if(tag.frameType != FLVTagVideo.FRAME_TYPE_KEYFRAME)
				return false;

			// But not config record.
			if(tag.avcPacketType == 0)
				return false;

			// It's an I-frame!
			return true;
		}

		private function onBufferTag(tag:FLVTag):Boolean

				// Do writing.
				CONFIG::LOGGING
				{
					logger.debug("Writing tag " + buffer.length + " bytes @ " + lastWrittenTime + "sec type=" + tag.tagType + " avcc=" + isTagAVCC(tag as FLVTagVideo) + " iFrame=" + isTagIFrame(tag as FLVTagVideo));
				}

				if(writeToMasterBuffer)
