         return UIImageView(image: image)
     }
     
+    //MARK: sample
     private var synctime:CMTime = kCMTimeZero
     private func receiveScreenSample(sample:CMSampleBuffer, type:RPSampleBufferType, error:Error?)
     {

            writer.append(sample: sample, type: type)
            if type == .video
            {
                let time = CMSampleBufferGetPresentationTimeStamp(sample)
                if Int(time.seconds) % 5 == 0 && (time - synctime).seconds >= 1
                {
                    synctime = time
                    synchronize(timestamp: time.seconds)
                }
            }
        }

            }
        }
        
        timeOffset = CMSampleBufferGetPresentationTimeStamp(sample)
        
        writer.startWriting()
        writer.startSession(atSourceTime: timeOffset)
    }
    
    private(set) var timeOffset:CMTime = kCMTimeZero
    
    private let background = DispatchQueue(label: "video_encode_queue")
    func append(sample:CMSampleBuffer, type:RPSampleBufferType)
    {
