public static DetectVideoShotResponse Unmarshall(UnmarshallerContext _ctx) { DetectVideoShotResponse detectVideoShotResponse = new DetectVideoShotResponse(); detectVideoShotResponse.HttpResponse = _ctx.HttpResponse; detectVideoShotResponse.RequestId = _ctx.StringValue("DetectVideoShot.RequestId"); DetectVideoShotResponse.DetectVideoShot_Data data = new DetectVideoShotResponse.DetectVideoShot_Data(); List <string> data_shotFrameIds = new List <string>(); for (int i = 0; i < _ctx.Length("DetectVideoShot.Data.ShotFrameIds.Length"); i++) { data_shotFrameIds.Add(_ctx.StringValue("DetectVideoShot.Data.ShotFrameIds[" + i + "]")); } data.ShotFrameIds = data_shotFrameIds; detectVideoShotResponse.Data = data; return(detectVideoShotResponse); }
public DetectVideoShotResponse DetectVideoShotAdvance(DetectVideoShotAdvanceRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime) { // Step 0: init client string accessKeyId = this._credential.GetAccessKeyId(); string accessKeySecret = this._credential.GetAccessKeySecret(); AlibabaCloud.RPCClient.Models.Config authConfig = new AlibabaCloud.RPCClient.Models.Config { AccessKeyId = accessKeyId, AccessKeySecret = accessKeySecret, Type = "access_key", Endpoint = "openplatform.aliyuncs.com", Protocol = _protocol, RegionId = _regionId, }; AlibabaCloud.SDK.OpenPlatform20191219.Client authClient = new AlibabaCloud.SDK.OpenPlatform20191219.Client(authConfig); AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadRequest authRequest = new AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadRequest { Product = "videorecog", RegionId = _regionId, }; AlibabaCloud.SDK.OpenPlatform20191219.Models.AuthorizeFileUploadResponse authResponse = authClient.AuthorizeFileUpload(authRequest, runtime); // Step 1: request OSS api to upload file AlibabaCloud.OSS.Models.Config ossConfig = new AlibabaCloud.OSS.Models.Config { AccessKeyId = authResponse.AccessKeyId, AccessKeySecret = accessKeySecret, Type = "access_key", Endpoint = AlibabaCloud.Commons.Common.GetEndpoint(authResponse.Endpoint, authResponse.UseAccelerate, _endpointType), Protocol = _protocol, RegionId = _regionId, }; AlibabaCloud.OSS.Client ossClient = new AlibabaCloud.OSS.Client(ossConfig); AlibabaCloud.SDK.TeaFileform.Models.FileField fileObj = new AlibabaCloud.SDK.TeaFileform.Models.FileField { Filename = authResponse.ObjectKey, Content = request.VideoUrlObject, ContentType = "", }; AlibabaCloud.OSS.Models.PostObjectRequest.PostObjectRequestHeader ossHeader = new AlibabaCloud.OSS.Models.PostObjectRequest.PostObjectRequestHeader { AccessKeyId = authResponse.AccessKeyId, Policy = authResponse.EncodedPolicy, Signature = authResponse.Signature, Key = authResponse.ObjectKey, File = fileObj, SuccessActionStatus = "201", }; AlibabaCloud.OSS.Models.PostObjectRequest uploadRequest = new AlibabaCloud.OSS.Models.PostObjectRequest { BucketName = authResponse.Bucket, Header = ossHeader, }; AlibabaCloud.OSSUtil.Models.RuntimeOptions ossRuntime = new AlibabaCloud.OSSUtil.Models.RuntimeOptions(); AlibabaCloud.Commons.Common.Convert(runtime, ossRuntime); ossClient.PostObject(uploadRequest, ossRuntime); // Step 2: request final api DetectVideoShotRequest detectVideoShotreq = new DetectVideoShotRequest(); AlibabaCloud.Commons.Common.Convert(request, detectVideoShotreq); detectVideoShotreq.VideoUrl = "http://" + authResponse.Bucket + "." + authResponse.Endpoint + "/" + authResponse.ObjectKey; DetectVideoShotResponse detectVideoShotResp = DetectVideoShot(detectVideoShotreq, runtime); return(detectVideoShotResp); }