Ejemplo n.º 1
0
        private IEnumerator SendTusRequest()
        {
            ReadBytes();

            m_uploadRequest = UnityWebRequest.Put(m_url, bytes);
            SetupTusRequest(m_uploadRequest);
            m_uploadRequest.method = "PATCH";
            m_uploadRequest.SetRequestHeader("Upload-Offset", m_lastByteUploaded.ToString());
            m_uploadRequest.SetRequestHeader("Content-Type", "application/offset+octet-stream");

            m_isUploading = true;

            yield return(VimeoApi.SendRequest(m_uploadRequest));

            if (VimeoApi.IsNetworkError(m_uploadRequest))
            {
                UploadError(m_uploadRequest.responseCode + ": " + m_uploadRequest.error);
            }
            else
            {
                m_isUploading         = false;
                m_isFinishedUploading = true;
                if (OnChunkUploadComplete != null)
                {
                    OnChunkUploadComplete(this, m_uploadRequest.GetResponseHeader("Upload-Offset"));
                }
            }

            DisposeBytes();
        }