I want to change the upload timeout(default: 5000) by passing options of client’s stop_recordingscreen command.
But it can’t be reached to the upload function.
const MIN_EMULATOR_API_LEVEL = 27;
const FFMPEG_BINARY = `ffmpeg${system.isWindows() ? '.exe' : ''}`;
async function uploadRecordedMedia (localFile, remotePath = null, uploadOptions = {}) {
if (_.isEmpty(remotePath)) {
const {size} = await fs.stat(localFile);
log.debug(`The size of the resulting screen recording is ${util.toReadableSizeString(size)}`);
return (await util.toInMemoryBase64(localFile)).toString();
}
const {user, pass, method, headers, fileFieldName, formFields} = uploadOptions;
const options = {
method: method || 'PUT',
headers,
fileFieldName,
formFields,
};
if (user && pass) {
options.auth = {user, pass};
}
await net.uploadFile(localFile, remotePath, options);
if (!await fs.exists(localPath)) {
log.errorAndThrow(`The file at '${localPath}' does not exist or is not accessible`);
}
if (_.isEmpty(remotePath)) {
const {size} = await fs.stat(localPath);
log.debug(`The size of the file is ${util.toReadableSizeString(size)}`);
return (await util.toInMemoryBase64(localPath)).toString();
}
const {user, pass, method, headers, fileFieldName, formFields} = uploadOptions;
const options = {
method: method || 'PUT',
headers,
fileFieldName,
formFields,
};
if (user && pass) {
options.auth = {user, pass};
}
await net.uploadFile(localPath, remotePath, options);
Thanks.
This is the HTTP read timeout and is not configurable via REST API. You could change its default value at https://github.com/appium/appium-support/blob/5b2db87136efa8eae4bcc81634b171d7670fd788/lib/net.js#L28
1 Like