         isFullScreen = isForFullScreen
         setNeedsLayout()
         
-//        if (isFullScreen) {
-//            print("xxx")
-//            playerNode?.rotation = SCNVector4(x: 0, y: 0, z: 1, w: Float(M_PI_2))
-//        } else {
-//            print("sss")
-//            playerNode?.rotation = SCNVector4Zero
-//            
-//        }
+        // Flip video upside down, so that it's shown in the right position
+        if (isFullScreen) {
+            
+            var transform = SCNMatrix4MakeRotation(Float(M_PI), 0.0, 0.0, 1.0)
+            transform = SCNMatrix4Translate(transform, 1.0, 1.0, 0.0)
+            
+            playerNode?.pivot = SCNMatrix4MakeRotation(Float(M_PI_2), 0.0, 1.0, 0.0)
+            playerNode?.geometry?.firstMaterial?.diffuse.contentsTransform = transform
+            
+        } else {
+            var transform = SCNMatrix4MakeRotation(Float(M_PI), 0.0, 0.0, 1.0)
+            transform = SCNMatrix4Translate(transform, 1.0, 1.0, 0.0)
+            
+            playerNode?.pivot = SCNMatrix4MakeRotation(Float(M_PI), 0.0, -1.0, 0.0)
+            playerNode?.geometry?.firstMaterial?.diffuse.contentsTransform = transform
+            
+        }
     }
     
     func switchMode() {

        leftSceneView.pointOfView = leftCameraNode
        rightSceneView.pointOfView = rightCameraNode
        
//        let ligth = SCNLight()
        
    }
    
    /// Create focal spot

//  Created by sheldon on 2016/11/17.
//  Copyright © 2016年 kankan. All rights reserved.
//

//http://stackoverflow.com/questions/29252418/how-to-play-360-video-on-the-ios-device

import UIKit
import QuartzCore
