                 self.player!.muted = self.muted
                 NSNotificationCenter.defaultCenter().removeObserver(self)
                 NSNotificationCenter.defaultCenter().addObserver(self,
-                    selector: "playerItemDidReachEnd",
+                    selector: "playerItemDidReachEnd:",
                     name: AVPlayerItemDidPlayToEndTimeNotification,
                     object: playerItem)
+                self.playerLayer.player = self.player
                 self.player!.play()
+                self.layoutSubviews()
             }
         }
     }

        
        {
            self.videoUrl = videoUrl;
        }()
    }
    
    public init(videoUrlString: String) {
        self.init();
        
        {
            self.videoUrlString = videoUrlString;
        }()
    }
    

            }
        }
    }
    @IBInspectable public var muted: Bool = true {
        didSet {
            self.player?.muted = self.muted
