Esempio n. 1
0
        IEnumerator GetTicket()
        {
            if (OnUploadProgress != null)
            {
                OnUploadProgress("Authorizing", 0);
            }

            WWWForm form = new WWWForm();

            form.AddField("type", "streaming");

            using (UnityWebRequest request = UnityWebRequest.Post(API_URL + "/me/videos", form)) {
                PrepareHeaders(request, "3.2");
                yield return(VimeoApi.SendRequest(request));

                if (IsNetworkError(request))
                {
                    Debug.LogError(request.error);
                }
                else
                {
                    VimeoTicket ticket = VimeoTicket.CreateFromJSON(request.downloadHandler.text);

                    if (ticket.error == null)
                    {
                        StartCoroutine(UploadVideo(ticket));
                    }
                    else
                    {
                        Debug.LogError(ticket.error + " " + ticket.developer_message);
                    }
                }
            }
        }
Esempio n. 2
0
        IEnumerator GetTicket()
        {
            if (OnUploadProgress != null)
            {
                OnUploadProgress("Authorizing", 0);
            }

            WWWForm form = new WWWForm();

            form.AddField("type", "streaming");

            using (UnityWebRequest request = UnityWebRequest.Post(API_URL + "/me/videos", form)) {
                request.chunkedTransfer = false;
                request.SetRequestHeader("Authorization", "Bearer " + token);
                yield return(VimeoApi.SendRequest(request));

                if (IsNetworkError(request))
                {
                    Debug.LogError(request.error);
                }
                else
                {
                    VimeoTicket ticket = VimeoTicket.CreateFromJSON(request.downloadHandler.text);

                    if (ticket.error == null)
                    {
                        StartCoroutine(UploadVideo(ticket));
                    }
                    else
                    {
                        Debug.LogError(ticket.error);
                    }
                }
            }
        }
Esempio n. 3
0
    IEnumerator GetTicket()
    {
        WWWForm form = new WWWForm();

        form.AddField("type", "streaming");

        using (UnityWebRequest request = UnityWebRequest.Post("https://api.vimeo.com/me/videos", form)) {
            request.SetRequestHeader("Authorization", "Bearer " + token);

            yield return(request.Send());

            if (request.isNetworkError)
            {
                Debug.Log(request.error);
            }
            else
            {
                Debug.Log(request.downloadHandler.text);
                VimeoTicket ticket = VimeoTicket.CreateFromJSON(request.downloadHandler.text);
                //Debug.Log (ticket.ticket_id);
                StartCoroutine(UploadVideo(ticket));
            }
        }
    }