{"action":"created","issue":{"url":"https://api.github.com/repos/tus/tus-android-client/issues/19","repository_url":"https://api.github.com/repos/tus/tus-android-client","labels_url":"https://api.github.com/repos/tus/tus-android-client/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/tus/tus-android-client/issues/19/comments","events_url":"https://api.github.com/repos/tus/tus-android-client/issues/19/events","html_url":"https://github.com/tus/tus-android-client/issues/19","id":322830785,"number":19,"title":"unexpected status code (405) while creating upload","user":{"login":"fmanoir","id":24919155,"avatar_url":"https://avatars0.githubusercontent.com/u/24919155?v=4","gravatar_id":"","url":"https://api.github.com/users/fmanoir","html_url":"https://github.com/fmanoir","followers_url":"https://api.github.com/users/fmanoir/followers","following_url":"https://api.github.com/users/fmanoir/following{/other_user}","gists_url":"https://api.github.com/users/fmanoir/gists{/gist_id}","starred_url":"https://api.github.com/users/fmanoir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmanoir/subscriptions","organizations_url":"https://api.github.com/users/fmanoir/orgs","repos_url":"https://api.github.com/users/fmanoir/repos","events_url":"https://api.github.com/users/fmanoir/events{/privacy}","received_events_url":"https://api.github.com/users/fmanoir/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-14T14:03:04Z","updated_at":"2018-05-20T22:11:43Z","closed_at":"2018-05-20T22:11:43Z","author_association":"NONE","body":"**URL:** https://files.tus.vimeo.com/files/vimeo-prod-src-tus-eu/83bb82bbb6073e56fae728ed53b322fb\r\n**Data :** /data/user/0/com.XXXX/cache/temp1341568618.mp4\r\n\r\n  \r\n        TusClient client = new TusClient();\r\n        try {\r\n            client.setUploadCreationURL(new URL(link));\r\n\r\n            InputStream inputStream = getActivity().getContentResolver().openInputStream(uri);\r\n            File tempFile = File.createTempFile(\"temp\", \".mp4\");\r\n            tempFile.deleteOnExit();\r\n            FileOutputStream out = new FileOutputStream(tempFile);\r\n            IOUtils.copy(inputStream, out);\r\n            final TusUpload upload = new TusUpload(tempFile);\r\n\r\n            Log.e(\"link\",link+\"\");\r\n            Log.e(\"tempFile\",tempFile.getPath()+\"\");\r\n\r\n            getActivity().runOnUiThread(new Runnable() {\r\n\r\n                @Override\r\n                public void run() {\r\n                    mProgress.setProgress(0);\r\n                    mViewProgress.setVisibility(View.VISIBLE);\r\n                    mHideView2.setVisibility(View.VISIBLE);\r\n                    mHideView1.setVisibility(View.VISIBLE);\r\n                }\r\n            });\r\n            TusExecutor executor = new TusExecutor() {\r\n                @Override\r\n                protected void makeAttempt() throws ProtocolException, IOException {\r\n                    TusUploader uploader = client.resumeOrCreateUpload(upload);\r\n                    uploader.setChunkSize(1024);\r\n                    do {\r\n                        long totalBytes = upload.getSize();\r\n                        long bytesUploaded = uploader.getOffset();\r\n                        double progress = (double) bytesUploaded / totalBytes * 100;\r\n                        getActivity().runOnUiThread(new Runnable() {\r\n                            @Override\r\n                            public void run() {\r\n                                mProgress.setProgress((int) progress);\r\n                            }\r\n                        });\r\n                    } while (uploader.uploadChunk() > -1);\r\n\r\n                    uploader.finish();\r\n                    getActivity().runOnUiThread(new Runnable() {\r\n                        @Override\r\n                        public void run() {\r\n                            mViewProgress.setVisibility(View.GONE);\r\n                            mHideView2.setVisibility(View.GONE);\r\n                            mHideView1.setVisibility(View.GONE);\r\n                        }\r\n                    });\r\n                }\r\n            };\r\n            executor.makeAttempts();\r\n\r\n        } catch (Exception e) {\r\n            e.printStackTrace();\r\n        }\r\n\r\n\r\n\r\n    }"},"comment":{"url":"https://api.github.com/repos/tus/tus-android-client/issues/comments/390516753","html_url":"https://github.com/tus/tus-android-client/issues/19#issuecomment-390516753","issue_url":"https://api.github.com/repos/tus/tus-android-client/issues/19","id":390516753,"user":{"login":"Acconut","id":1375043,"avatar_url":"https://avatars3.githubusercontent.com/u/1375043?v=4","gravatar_id":"","url":"https://api.github.com/users/Acconut","html_url":"https://github.com/Acconut","followers_url":"https://api.github.com/users/Acconut/followers","following_url":"https://api.github.com/users/Acconut/following{/other_user}","gists_url":"https://api.github.com/users/Acconut/gists{/gist_id}","starred_url":"https://api.github.com/users/Acconut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Acconut/subscriptions","organizations_url":"https://api.github.com/users/Acconut/orgs","repos_url":"https://api.github.com/users/Acconut/repos","events_url":"https://api.github.com/users/Acconut/events{/privacy}","received_events_url":"https://api.github.com/users/Acconut/received_events","type":"User","site_admin":false},"created_at":"2018-05-20T22:11:43Z","updated_at":"2018-05-20T22:11:43Z","author_association":"MEMBER","body":"This has been implemented in tus-java-client 0.4.0. You can use the new `TusClient#beginOrResumeUploadFromURL` method as such (I marked the two changes with comments):\r\n\r\n```java\r\n TusClient client = new TusClient();\r\n    try {\r\n        // Notice! No call to client.setUploadCreationURL here.\r\n\r\n        InputStream inputStream = getActivity().getContentResolver().openInputStream(uri);\r\n        File tempFile = File.createTempFile(\"temp\", \".mp4\");\r\n        tempFile.deleteOnExit();\r\n        FileOutputStream out = new FileOutputStream(tempFile);\r\n        IOUtils.copy(inputStream, out);\r\n        final TusUpload upload = new TusUpload(tempFile);\r\n\r\n        Log.e(\"link\",link+\"\");\r\n        Log.e(\"tempFile\",tempFile.getPath()+\"\");\r\n\r\n        getActivity().runOnUiThread(new Runnable() {\r\n            @Override\r\n            public void run() {\r\n                mProgress.setProgress(0);\r\n                mViewProgress.setVisibility(View.VISIBLE);\r\n                mHideView2.setVisibility(View.VISIBLE);\r\n                mHideView1.setVisibility(View.VISIBLE);\r\n            }\r\n        });\r\n        TusExecutor executor = new TusExecutor() {\r\n            @Override\r\n            protected void makeAttempt() throws ProtocolException, IOException {\r\n                // Notice! We pass `link` into this method to tell it where to upload to\r\n                TusUploader uploader = client.beginOrResumeUploadFromURL(upload, new URL(link));\r\n                uploader.setChunkSize(1024);\r\n                do {\r\n                    long totalBytes = upload.getSize();\r\n                    long bytesUploaded = uploader.getOffset();\r\n                    double progress = (double) bytesUploaded / totalBytes * 100;\r\n                    getActivity().runOnUiThread(new Runnable() {\r\n                        @Override\r\n                        public void run() {\r\n                            mProgress.setProgress((int) progress);\r\n                        }\r\n                    });\r\n                } while (uploader.uploadChunk() > -1);\r\n\r\n                uploader.finish();\r\n                getActivity().runOnUiThread(new Runnable() {\r\n                    @Override\r\n                    public void run() {\r\n                        mViewProgress.setVisibility(View.GONE);\r\n                        mHideView2.setVisibility(View.GONE);\r\n                        mHideView1.setVisibility(View.GONE);\r\n                    }\r\n                });\r\n            }\r\n        };\r\n        executor.makeAttempts();\r\n\r\n    } catch (Exception e) {\r\n        e.printStackTrace();\r\n    }\r\n\r\n\r\n\r\n}"}}
{"actor":{"display_login":"Acconut"}}