/// <summary> /// Exports video by video ID /// </summary> public void Export(string videoID, RestExecutor.ResponseHandler onResponse = null) { var req = new RestExecutor.Request(String.Format("/download/{0}", videoID)); req.method = "GET"; req.responseHandler = onResponse; SendRequest(req); }
/// <summary> /// Get video length by video ID /// </summary> public void GetVideoLength(string videoID, RestExecutor.ResponseHandler onResponse = null) { var req = new RestExecutor.Request("/video/" + videoID); req.method = "GET"; req.responseHandler = onResponse; SendRequest(req); }
/// <summary> /// Removes video by video ID /// </summary> public void Remove(string videoID, RestExecutor.ResponseHandler onResponse = null) { var req = new RestExecutor.Request( String.Format("/video/{0}", videoID)); req.method = "DELETE"; req.responseHandler = onResponse; SendRequest(req); }
/// <summary> /// Initiate asynchronous refresh request to REST server. OnRefreshed /// event is fired once done. /// </summary> public void Refresh() { if (refreshInProgress) { return; } refreshInProgress = true; var req = new RestExecutor.Request <StreamData[]>("streams"); req.responseHandler = ProcessRefreshResponse; SendRequest(req); }
/// <summary> /// Initiate recording of specified stream or stops it /// </summary> public void Record(int streamPort, bool setRecorgingOn, string videoID, RestExecutor.ResponseHandler onResponse) { var req = new RestExecutor.Request("stream"); string tmpStr = "{ \"port\": " + streamPort + ", \"is_recording_active\": " + setRecorgingOn.ToString().ToLower() + ", \"video_id\": \"" + videoID + "\" }"; byte[] buffer = Encoding.ASCII.GetBytes(tmpStr); req.body = buffer; req.bodyMimeType = "application/json; charset=UTF-8"; req.method = "PUT"; req.responseHandler = onResponse; SendRequest(req); }
/// <summary> /// Send request to the server. The response handler specified in the request /// is called in Unity thread. /// </summary> public void SendRequest(RestExecutor.Request req) { var handler = req.responseHandler; if (handler != null) { req.responseHandler = (object response, Exception error) => { handler(response, error); }; } executor.SendRequest(req); }