예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        /// <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);
        }