Kaltura Upload Video - Error 413

2019-06-01 23:15发布

问题:

I am using the Kaltura client library for Android to upload a video.

It successfully creates the entry on the server, but when it gets to the point of actually uploading the video file, it fails with Error 413 - Request Entity Too Large.

KalturaMediaEntry mediaEntry = new KalturaMediaEntry();
mediaEntry.name = title;
mediaEntry.mediaType = KalturaMediaType.VIDEO;

mediaEntry = kalturaClient.getMediaService().add(mediaEntry);

KalturaUploadToken token = new KalturaUploadToken();
token = kalturaClient.getUploadTokenService().add(token);

ContentResolver resolver = getContentResolver();
InputStream inStream = resolver.openInputStream(selectedVideoUri);

Cursor cursor = getContentResolver().query(selectedVideoUri, null, null, null, null);
int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE);
cursor.moveToFirst();
long size = cursor.getLong(sizeIndex);
cursor.close();


// this fails
kalturaClient.getUploadTokenService().upload(token.id, inStream, title, size);

I've tried using an extremely short video (2 seconds) and even that failed. Not sure where to look from here.