Cant replay video after finish playing
<p>I use following code to reveal two different video-sources as background. The "selectVideo" (<code>SegmentedControl</code>) is used to select video. The problem is down below.</p>

<pre><code>@IBAction func selectVideo(sender: AnyObject) {
    if self.Controller.selectedIndex == 1 {
        self.videoBackgroundCustomer()
    }

    if self.Controller.selectedIndex == 0 {
        self.videoBackgroundDriver()
    }
}

    func videoBackgroundDriver() {
        //Load video background.
        let videoURL: NSURL = NSBundle.mainBundle().URLForResource("background_video_2", withExtension: "mp4")!

        player = AVPlayer(URL: videoURL)
        videoBackground()
    }

    //Video background customer
    func videoBackgroundCustomer() {
        //Load video background.
        let videoURL: NSURL = NSBundle.mainBundle().URLForResource("background_video_1", withExtension: "mp4")!

        player = AVPlayer(URL: videoURL)
        videoBackground()
    }

    //Vieobackground-code part 2, provides with less code.
    func videoBackground() {
        player?.actionAtItemEnd = .None
        player?.muted = true

        let playerLayer = AVPlayerLayer(player: player)
        playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
        playerLayer.zPosition = -1

        playerLayer.frame = view.frame

        view.layer.addSublayer(playerLayer)

        player?.play()

        //call loop video
        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(LoginViewController.loopVideo), name: AVPlayerItemDidPlayToEndTimeNotification, object: player!.currentItem)
    }

    //Loop video
    func loopVideo() {
        player?.seekToTime(kCMTimeZero)
        player?.play()
    }
</code></pre>

<p><strong>Problem: The video restarts when the last video should have ended. And not when the most recent video ends.</strong></p>

<p>How do I make it repeat playing after the last playing video finished? Thanks </p>