本文为您提供了服务端 Go SDK 的视频剪辑模块的接口调用示例。
接口请求参数和返回参数详见 OpenAPI:提交异步剪辑任务。
package vod import ( "encoding/json" "fmt" "github.com/volcengine/volc-sdk-golang/base" "github.com/volcengine/volc-sdk-golang/service/vod" "github.com/volcengine/volc-sdk-golang/service/vod/models/request" "google.golang.org/protobuf/encoding/protojson" "testing" ) func Test_SubmitDirectEditTaskAsync(t *testing.T) { // Create a VOD instance in the specified region. // instance := vod.NewInstanceWithRegion("cn-north-1") instance := vod.NewInstance() // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65655. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // instance.SetCredential(base.Credentials{ // AccessKeyID: "your ak", // SecretAccessKey: "your sk", //}) params, _ := json.Marshal(map[string]interface{}{}) query := &request.VodSubmitDirectEditTaskAsyncRequest{ Uploader: "your target store vod space", Application: "your application", EditParam: params, Priority: 0, CallbackUri: "your CallbackUri if you need", CallbackArgs: "your CallbackArgs if you need", } resp, status, err := instance.SubmitDirectEditTaskAsync(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }
接口请求参数和返回参数详见 OpenAPI:提交同步剪辑任务。
// Code generated by protoc-gen-volcengine-sdk // source: VodEditService // DO NOT EDIT! package vod import ( "encoding/json" "fmt" "github.com/volcengine/volc-sdk-golang/base" "github.com/volcengine/volc-sdk-golang/service/vod" "github.com/volcengine/volc-sdk-golang/service/vod/models/request" "google.golang.org/protobuf/encoding/protojson" "testing" ) func Test_SubmitDirectEditTaskSync(t *testing.T) { // Create a VOD instance in the specified region. // instance := vod.NewInstanceWithRegion("cn-north-1") instance := vod.NewInstance() // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65655. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // instance.SetCredential(base.Credentials{ // AccessKeyID: "your ak", // SecretAccessKey: "your sk", //}) params, _ := json.Marshal(map[string]interface{}{}) query := &request.VodSubmitDirectEditTaskSyncRequest{ Uploader: "your target store vod space", Application: "your application", EditParam: params, } resp, status, err := instance.SubmitDirectEditTaskSync(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }
接口请求参数和返回参数详见 OpenAPI:取消剪辑任务。
package vod import ( "encoding/json" "fmt" "github.com/volcengine/volc-sdk-golang/base" "github.com/volcengine/volc-sdk-golang/service/vod" "github.com/volcengine/volc-sdk-golang/service/vod/models/request" "google.golang.org/protobuf/encoding/protojson" "testing" ) func Test_CancelDirectEditTask(t *testing.T) { // Create a VOD instance in the specified region. // instance := vod.NewInstanceWithRegion("cn-north-1") instance := vod.NewInstance() // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65655. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // instance.SetCredential(base.Credentials{ // AccessKeyID: "your ak", // SecretAccessKey: "your sk", //}) query := &request.VodCancelDirectEditTaskRequest{ ReqId: "your ReqId here", } resp, status, err := instance.CancelDirectEditTask(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }
接口请求参数和返回参数详见 OpenAPI:查询任务进度。
package vod import ( "encoding/json" "fmt" "github.com/volcengine/volc-sdk-golang/base" "github.com/volcengine/volc-sdk-golang/service/vod" "github.com/volcengine/volc-sdk-golang/service/vod/models/request" "google.golang.org/protobuf/encoding/protojson" "testing" ) func Test_GetDirectEditProgress(t *testing.T) { // Create a VOD instance in the specified region. // instance := vod.NewInstanceWithRegion("cn-north-1") instance := vod.NewInstance() // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65655. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // instance.SetCredential(base.Credentials{ // AccessKeyID: "your ak", // SecretAccessKey: "your sk", //}) query := &request.VodGetDirectEditProgressRequest{ ReqId: "your ReqId here", } resp, status, err := instance.GetDirectEditProgress(query) fmt.Println(status) fmt.Println(err) op := &protojson.MarshalOptions{ EmitUnpopulated: true, } format := op.Format(resp) fmt.Println(format) }
返回结果 Result 参数说明如下所示。
ResponseMetadata:{ RequestId:"2022102***2121601360E968B6F" Action:"GetDirectEditProgress" Version:"2018-01-01" Service:"vod" Region:"cn-north-1" } Result:{ }
ResponseMetadata:{ RequestId:"2022102815***21601360E968B6F" Action:"GetDirectEditProgress" Version:"2018-01-01" Service:"vod" Region:"cn-north-1" } Result:{ Result:100 }
接口请求参数和返回参数详见 OpenAPI:查询任务详情。
package vod import ( "encoding/json" "fmt" "github.com/volcengine/volc-sdk-golang/base" "github.com/volcengine/volc-sdk-golang/service/vod" "github.com/volcengine/volc-sdk-golang/service/vod/models/request" "google.golang.org/protobuf/encoding/protojson" "testing" ) func Test_GetDirectEditResult(t *testing.T) { // Create a VOD instance in the specified region. // instance := vod.NewInstanceWithRegion("cn-north-1") instance := vod.NewInstance() // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65655. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // instance.SetCredential(base.Credentials{ // AccessKeyID: "your ak", // SecretAccessKey: "your sk", //}) query := &request.VodGetDirectEditResultRequest{ ReqIds: []string{"your ReqId here"}, } resp, status, err := instance.GetDirectEditResult(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }