tus / tus-android-client

The tus client for Android.
https://tus.io/
161 stars 46 forks source link

error code 400 #32

Closed mohammedmans closed 5 years ago

mohammedmans commented 5 years ago

io.tus.java.client.ProtocolException: unexpected status code (400) while creating upload

Acconut commented 5 years ago

More details, such as the code and what you were doing, please. The error message itself is not helpful enough.

mohammedmans commented 5 years ago

get this error at: TusUploader uploader = client.resumeOrCreateUpload(upload); i use tus approach to uplaod video to vimeo, have upload link from vimeo and replace
"http://master.tus.io/files" with my uplaod link client.setUploadCreationURL(new URL(upload_link));

Acconut commented 5 years ago

You cannot use resumeOrCreateUpload with Vimeo but instead need to use beginOrResumeUploadFromURL as shown in this example: https://github.com/tus/tus-android-client/issues/19#issuecomment-390516753

mohammedmans commented 5 years ago

i changed to use beginOrResumeUploadFromURL instead resumeOrCreateUpload and get this exception "javax.net.ssl.SSLException: Write error: ssl=0x7885a6e308: I/O error during system call, Broken pipe"

mohammedmans commented 5 years ago

and when use same approach in example: #19 (comment) get "android.os.NetworkOnMainThreadException"

Acconut commented 5 years ago

You must not invoke tus-android-client or tus-java-client on the main thread since network activity is not allowed on the main thread. This is not related to tus directly but it's a restriction for any Android app. Have a look at https://github.com/tus/tus-android-client/blob/master/example/src/main/java/io/tus/android/example/MainActivity.java to see an example or just search the web to fix NetworkOnMainThreadException.

mohammedmans commented 5 years ago

it's worked now and upload to vimeo after adding this answer

Acconut commented 5 years ago

Glad to hear that it worked! I am going to close this issue then.

mohammedmans commented 5 years ago

i got this error: javax.net.ssl.SSLException: Write error: ssl=0x720c8a5208: I/O error during system call, Broken pipe, this answer solved that error yesterday but today i got same error

Acconut commented 5 years ago

Were you able to solve this issue or is it still a problem?