 //                    }
 //                }
 //            }
-        }
+//        }
     }
 
     func playerItemDidReachEnd(notification: NSNotification) {

                        cell.mediaView.image = image
                }

                if
                    let videoFileURL = NSFileManager.yepMessageVideoURLWithName(message.localAttachmentName) {
                        let asset = AVURLAsset(URL: videoFileURL, options: [:])
                        let playerItem = AVPlayerItem(asset: asset)

                        //let x = NSFileManager.defaultManager().fileExistsAtPath(videoFileURL.path!)

                        playerItem.seekToTime(kCMTimeZero)
                        //mediaView.videoPlayerLayer.player.replaceCurrentItemWithPlayerItem(playerItem)
                        let player = AVPlayer(playerItem: playerItem)

                        mediaControlView.timeLabel.text = ""

                        player.addPeriodicTimeObserverForInterval(CMTimeMakeWithSeconds(0.1, Int32(NSEC_PER_SEC)), queue: nil, usingBlock: { time in

                            guard let currentItem = player.currentItem else {
                                return
                            }

                            if currentItem.status == .ReadyToPlay {
                                let durationSeconds = CMTimeGetSeconds(currentItem.duration)
                                let currentSeconds = CMTimeGetSeconds(time)
                                let coundDownTime = Double(Int((durationSeconds - currentSeconds) * 10)) / 10
                                self.mediaControlView.timeLabel.text = "\(coundDownTime)"
                            }
                        })

                        NSNotificationCenter.defaultCenter().addObserver(self, selector: "playerItemDidReachEnd:", name: AVPlayerItemDidPlayToEndTimeNotification, object: player.currentItem)

                        mediaControlView.playAction = { mediaControlView in
                            player.play()

                            mediaControlView.playState = .Playing
                        }

                        mediaControlView.pauseAction = { mediaControlView in
                            player.pause()

                            mediaControlView.playState = .Pause
                        }

                        cell.mediaView.videoPlayerLayer.player = player

                        cell.mediaView.videoPlayerLayer.player?.addObserver(self, forKeyPath: "status", options: NSKeyValueObservingOptions(rawValue: 0), context: nil)

                        //mediaView.videoPlayerLayer.player.play()
                        //mediaView.imageView.removeFromSuperview()

                        mediaControlView.shareAction = {
                            let activityViewController = UIActivityViewController(activityItems: [videoFileURL], applicationActivities: nil)

                            self.presentViewController(activityViewController, animated: true, completion: { () -> Void in
                            })
                        }
                }

            default:
                break
            }


        let startIndexPath = NSIndexPath(forItem: startIndex, inSection: 0)
        mediasCollectionView.scrollToItemAtIndexPath(startIndexPath, atScrollPosition: .CenteredHorizontally, animated: false)

        guard let cell = mediasCollectionView.cellForItemAtIndexPath(startIndexPath) as? MediaViewCell else {
            return
        }

        let previewMedia = previewMedias[startIndex]

        prepareForShareWithCell(cell, previewMedia: previewMedia)
    }

    override func viewWillDisappear(animated: Bool) {
