 
         if let tag = trackingTag {
             view.removeTrackingRect(tag)
+        }
+        if videoFileReferencedURL {
+            let newSize = webView.bounds.size
+			let aspect = webSize.height / webSize.width
+            let magnify = newSize.width / webSize.width
+			let newHeight = newSize.width * aspect
+			let adjSize = NSMakeSize(newSize.width-1,newHeight-1)
+
+            webView.setMagnification(magnify, centeredAtPoint: NSMakePoint(adjSize.width/2.0, adjSize.height/2.0))
+			view.bounds.size = adjSize
         }
 
         trackingTag = view.addTrackingRect(view.bounds, owner: self, userData: nil, assumeInside: false)

    }

    var webView = WKWebView()
    var shouldRedirect: Bool {
        get {
            return !NSUserDefaults.standardUserDefaults().boolForKey(UserSetting.DisabledMagicURLs.userDefaultsKey)

                let percent = progress * 100
                var title = NSString(format: "Loading... %.2f%%", percent)
                if percent == 100 {
                    videoFileReferencedURL = false
                    let url = (self.webView.URL)

					// once loaded update window title,size with video name,dimension
					if let urlTitle = (self.webView.URL?.absoluteString) {
                        title = urlTitle

                        if ((url?.isFileReferenceURL()) != nil) {

                            //	if it's a video file, get and set window content size to its dimentions
                            if let track0 : AVAssetTrack = AVURLAsset(URL:url!, options:nil).tracks[0] {
                                if track0.mediaType == AVMediaTypeVideo {
                                    title = url!.lastPathComponent!
                                    webSize = track0.naturalSize
                                    webView.window?.setContentSize(webSize)
									webView.bounds.size = webSize
                                    videoFileReferencedURL = true
                                }
                            }
                            
                            //  Wait for URL to finish
                            let videoPlayer = AVPlayer(URL: url!)
                            let item = videoPlayer.currentItem
                            NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(WebViewController.playerDidFinishPlaying(_:)),
                                                                             name: AVPlayerItemDidPlayToEndTimeNotification, object: item)
						}
					} else {
                        title = "Helium"
                    }
					lastTitle = title as String
                }

                let notif = NSNotification(name: "HeliumUpdateTitle", object: title);
                NSNotificationCenter.defaultCenter().postNotification(notif)
            }
