[英]Transloadit cannot get ASSEMBLY_COMPLETED response in c#.net
參考下面的鏈接
https://github.com/nkranitz/transloadit-csharp-sdk使用transloadit進行視頻轉換並將其保存在C#中的s3中。 我能夠上傳視頻和圖像,並能夠獲得空結果的響應。 我的回答是“ok”:“ASSEMBLY_EXECUTING”,消息和結果標記為空。 因此,一旦執行程序集就像ASSEMBLY_COMPLETED一樣,我沒有得到最終響應。 所以,我看到有一些屬性assembly.setblocking = true ..但在C#中屬性不可用。 那么如何才能得到最終的響應,或者我如何在c#.net中使用阻塞屬性
請幫我解決這個問題。
提前致謝。
以下是代碼段
ITransloadit transloadit = new Transloadit.Transloadit(“APIKEY”,“Secret”);
//Create assembly builder to build up the assembly
IAssemblyBuilder assembly = new AssemblyBuilder();
//Add a file to be uploaded (with autogenerated key)
assembly.AddFile(@"filepath");
//Define the step, you can define more in the same assembly
IStep step = new Step();
step.SetOption("robot", "/image/resize");
step.SetOption("width", 75);
step.SetOption("height", 75);
step.SetOption("resize_strategy", "pad");
step.SetOption("background", "#000000");
//Add the step to the assembly
assembly.AddStep("thumb", step);
//Set notification URL
assembly.SetNotifyURL("url");
//Set the expiration date time of the request for the assembly
//Assembly will be expired in 120 minutes from now
assembly.SetAuthExpires(DateTime.Now.AddMinutes(120));
//Invoke assembly, and wait for the result
TransloaditResponse response = transloadit.InvokeAssembly(assembly);
if (response.Success)
{
// LoggerFactory.GetLogger().LogInfo(Type.GetType("TestConsole.Program"), "Assembly {0} result", response.Data);
}
在第一個響應中,您應該看到assembly_url
。 您可以/應該每隔X秒輪詢該URL以獲取更新。 當程序集到達ASSEMBLY_CANCELED
ASSEMBLY_COMPLETED
REQUEST_ABORTED
,或者設置了error
,它就完成了。 我不確定此輪詢的樣板是否在SDK中實現,您必須檢查。
不建議使用阻擋組件,因為它們需要保持連接打開,這樣更脆弱。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.