Archived from the Transloadit support forum. Originally posted on December 9, 2014; details may be outdated, see our docs for current behavior. Original thread
Hi Transload-it support,
We’ve changed from the original iOS Transload-it SDK to the latest SDK (to support Apple’s 64-bit app requirement).
Most of the Transload-it calls ported across easily, with a 1:1 match of old to new API’s as follows:
OLD SDK:
TransloaditRequest* transload = [[TransloaditRequest alloc] initWithCredentials: [Configuration sharedConfiguration].transloaditKey secret: [Configuration sharedConfiguration].transloaditSecret];
[transload setTemplateId: [Configuration sharedConfiguration].videoTemplateId];
[transload addRawFile: _exportedVideoPath withFileName: @"video.mp4" addContentType: @"video/mp4"];
[transload setNumberOfTimesToRetryOnTimeout: 5];
NSDictionary* steps = @{
@"export": @{
@"bucket": [Configuration sharedConfiguration].awsBucket,
@"path": [NSString stringWithFormat: @"uploads/story/%d/story_video_${assembly.id}_${previous_step.name}", _userId],
},
@"save": @{
@"bucket": [Configuration sharedConfiguration].awsBucket,
@"path": [NSString stringWithFormat: @"uploads/story/%d/story_video_${assembly.id}_original", _userId],
}
};
[[transload params] setObject: steps forKey: @"steps"];
[[transload params] setObject: [Configuration sharedConfiguration].videoNotificationUrl forKey: @"notify_url"];
[transload setDelegate: self];
[transload startAsynchronous];
NEW SDK:
NSObject<ITransloadit>* transloadit = [[Transloadit alloc] init: [Configuration sharedConfiguration].transloaditKey];
[transloadit useSignature: [Configuration sharedConfiguration].transloaditSecret];
NSObject<IAssemblyBuilder>* assembly = [[AssemblyBuilder alloc] init];
[assembly setTemplateID: [Configuration sharedConfiguration].videoTemplateId];
NSError* error;
[assembly addFileWithName: @"video.mp4" file: [NSData dataWithContentsOfURL: [NSURL URLWithString: _exportedVideoPath]] withError: error];
NSObject<IStep>* exportStep = [[Step alloc] init];
[exportStep setOptionKey: @"bucket" object: [Configuration sharedConfiguration].awsBucket];
[exportStep setOptionKey: @"path" object: [NSString stringWithFormat: @"uploads/story/%d/story_video_${assembly.id}_${previous_step.name}", _userId]];
[assembly addStepName: @"export" step: exportStep];
NSObject<IStep>* saveStep = [[Step alloc] init];
[saveStep setOptionKey: @"bucket" object: [Configuration sharedConfiguration].awsBucket];
[saveStep setOptionKey: @"path" object: [NSString stringWithFormat: @"uploads/story/%d/story_video_${assembly.id}_original", _userId]];
[assembly addStepName: @"save" step: saveStep];
[assembly setNotifyURL: [Configuration sharedConfiguration].videoNotificationUrl];
TransloaditResponse* response = [transloadit invokeAssembly: assembly withError: error];
I have a few questions on different API functionality:
- The number of times to retry on timeout (setNumberOfTimesToRetryOnTimeout). Is there an new SDK equivalent?
- The old addRawFile:withFileName:addContentType: doesn’t quite match addFileWithName:file:withError.
2a. Does the content type (video/mp4) of the old SDK not need to appear anywhere using the new SDK? 2b. Does the old SDK stream the file from disk whereas the new SDK needs to load into memory the audio clip to send? (Or did the old SDK also internally load the entire audio clip into memory?) - and there is also a delay problem with the new SDK. After 10 seconds of attempting to send to Transload-it, the request time-outs with some ERROR:’s printed to the console, then it works after another 13 seconds.
What do the ERROR:’s mean and how do we go about fixing this to make the new SDK work as well as the old SDK?
2014-12-09 18:01:53.887 MobileStorypark[19084:1283850] VoiceUploadJob.run:29 Sending voice to Transloadit
2014-12-09 18:02:03.890 MobileStorypark[19084:1283949] ERROR: DefaultHttpExecutor -- The request timed out.
2014-12-09 18:02:03.891 MobileStorypark[19084:1283949] ERROR: TransloaditRequest -- (null)
2014-12-09 18:02:03.891 MobileStorypark[19084:1283949] ERROR: Transloadit -- (null) -- Bored instance host is invalid using default path (null)
2014-12-09 18:02:16.841 MobileStorypark[19084:1283949] INFO: DefaultHttpExecutor -- {"ok":"ASSEMBLY_COMPLETED","message":"The assembly was successfully completed.","assembly_id":"REDACTED","parent_id":null,"account_id":"REDACTED","template_id":"REDACTED","instance":"sihaam.transloadit.com","assembly_url":"http://api2.sihaam.transloadit.com/assemblies/REDACTED","assembly_ssl_url":"https://sihaam.transloadit.com/assemblies/REDACTED","bytes_received":21275,"bytes_expected”: …
Thanks.