         if progress.fractionCompleted >= 1 {
             timer.invalidate()
             attachment.progress = nil
-            if let videoAttachment = attachment as? VideoAttachment, let videoURL = progress.userInfo[ProgressUserInfoKey("videoURL")] as? URL {
+            if let videoAttachment = attachment as? VideoAttachment, let videoURL = progress.userInfo[MediaProgressKey.mediaID] as? URL {
                 videoAttachment.srcURL = videoURL
                 richTextView.update(attachment: videoAttachment)
             }


    @objc func timerFireMethod(_ timer: Timer) {
        guard let progress = timer.userInfo as? Progress,
              let imageId = progress.userInfo[ProgressUserInfoKey("imageID")] as? String,
              let attachment = richTextView.attachment(withId: imageId)
        else {
            timer.invalidate()

        let posterImage = UIImage(cgImage: cgImage)
        let posterURL = saveToDisk(image: posterImage)
        let attachment = richTextView.insertVideo(atLocation: index, sourceURL: URL(string:"placeholder://")!, posterURL: posterURL, placeHolderImage: posterImage)
        let mediaID = attachment.identifier
        let progress = Progress(parent: nil, userInfo: [MediaProgressKey.mediaID: mediaID, MediaProgressKey.videoURL:videoURL])
        progress.totalUnitCount = 100

        Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(EditorDemoController.timerFireMethod(_:)), userInfo: progress, repeats: true)
