Cannot upload video file using 'POST media/upload' but image ok

video
rest
api

#1

I’m implementing uploading pictures and videos now.
I found that there are two ways to upload files.
They are ‘POST media/upload’, ‘POST media/upload (chunked)’.
I already tried both apis and figured out first one is faster than second.

Now, I can upload videos and images by using ‘Chunked API’.
I’m sending formdata like this.

        var fd = new FormData();
        fd.append('command', command);
        fd.append('media_id', media_id);
        fd.append('media_data', media_data);
        fd.append('segment_index', segment_index);

and it works well but slow.

So, I tried ‘POST media/upload’ api and could upload image file.
Please see formdata. ‘encodedData’ means base64 encdoed.

        var fd = new FormData();
        fd.append('media_data', encodedData); 

and it works well only if I send image but not video.
Error message is
{“request”:"/1.1/media/upload.json",“error”:“media type unrecognized.”}

I wonder why I cannot upload video.


#2

I was told that Twitter require chunked upload for video to minimize many potential issues.