//
//  CameraViewController.swift
//  Home
//
//  Created by Richard Kuckovsky on 2.5.17.
//  Copyright © 2017 Richard Kuckovsky. All rights reserved.
//

import UIKit

class CameraViewController: UIViewController {

    
    @IBOutlet weak var video_image: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    override func viewDidAppear(_ animated: Bool) {
        print("start")
        SocketIOManager.sharedInstance.video_start()
        SocketIOManager.sharedInstance.videoUpdate(completionHandler: { (image) -> Void in
            print("som tu")
            self.video_image.image = image
        })
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        SocketIOManager.sharedInstance.dissVideoUpdate()
        SocketIOManager.sharedInstance.video_stop()
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
