         let playerItem = AVPlayerItem(url:videoURL)
         videoPlayer.replaceCurrentItem(with: playerItem)
         
+        if let elements = document["elements"] as? [[String:Any]] {
+            print("elements", elements)
+            for element in elements {
+                if let id = element["id"] as? String,
+                   let h = element["h"] as? CGFloat,
+                   let w = element["w"] as? CGFloat {
+                   let layer = CALayer()
+                   layer.frame = CGRect(origin: .zero, size: CGSize(width: w, height: h))
+                   layer.backgroundColor = UIColor.blue.cgColor
+                   layers[id] = layer
+                }
+            }
+        }
+        //moveToPageAt(index: 0)
+        
         callback(1.0, nil)
     }
     

    fileprivate var videoLayer:AVPlayerLayer!
    fileprivate var index = 0
    fileprivate var observer:Any?
    
    deinit {
        print("deinit")
    }

    override func viewDidLoad() {

        if let observer = self.observer {
            videoPlayer.removeTimeObserver(observer)
            self.observer = nil
            print("SVideoC remove observer")
        }
    }

    func moveToPageAt(index:Int) {
        print("SVideoC moveToPageAt", index)
        if index < pages.count {
            self.index = index
            let page = pages[self.index]
