    *************************************************************************************/
   func startVideo(id:String) {
     if videoCapture == nil {
+      stopVideoTimer()
       deleteVideo()
       videoCapture = ASScreenRecorder()
       videoCapture!.videoURL = videoUrl
       videoCapture!.bitrate = 8000000
       videoCapture!.scale = 1.0
       videoCapture!.startRecording()
+      // Limit video recording to 30 minutes to make sure we don't chew up ALL of the storage
+      videoTimer = Timer.scheduledTimer(timeInterval: 1800, target: self, selector: #selector(self.videoTimerFired), userInfo: nil, repeats: false)
       sendMessage(id:id, message:"OK")
     } else {
       sendMessage(id:id, message:"ERROR")
     }
   }
   
+  @objc func videoTimerFired() {
+    self.log("Video timer fired, stopping recording")
+    stopVideoTimer()
+    if videoCapture != nil {
+      videoCapture!.stopRecording() {
+        self.videoCapture = nil
+      }
+    }
+  }
+  
+  func stopVideoTimer() {
+    if videoTimer != nil {
+      if videoTimer!.isValid {
+        videoTimer!.invalidate()
+      }
+      videoTimer = nil
+    }
+  }
+  
   func stopVideo(id:String) {
+    stopVideoTimer()
     if videoCapture != nil {
       videoCapture!.stopRecording() {
         self.videoCapture = nil

  }

  func timestamp() -> Double {
    let now = DispatchTime.now()
    let nanoTime = now.uptimeNanoseconds - startTime.uptimeNanoseconds
    let elapsed = Double(nanoTime / 100) / 1_000_000.0
    return elapsed
  }


    } while cont
    socket.close()
    self.log("\(id): Socket closed")
    DispatchQueue.main.async {
      self.clientDisconnected()
    }
  }
  
  func receivedRawData(id:Int, str:String) {
