本文为您提供了服务端 Go SDK 的媒体处理模块的接口调用示例。
接口请求参数和返回参数详见 OpenAPI:触发工作流。
package vod import ( "fmt" "testing" "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" ) func Test_StartWorkflow(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.VodStartWorkflowRequest{ Vid: "your Vid", TemplateId: "your TemplateId", Input: nil, Priority: 0, CallbackArgs: "your CallbackArgs", EnableLowPriority: false, } resp, status, err := instance.StartWorkflow(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }
接口请求参数和返回参数详见 OpenAPI:获取转码结果。
package vod import ( "fmt" "testing" "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" ) func Test_RetrieveTranscodeResult(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.VodRetrieveTranscodeResultRequest{ Vid: "your Vid", ResultType: "your ResultType", } resp, status, err := instance.RetrieveTranscodeResult(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }
接口请求参数和返回参数详见 OpenAPI:获取工作流运行状态。
package vod import ( "fmt" "testing" "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" ) func Test_GetWorkflowExecution(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.VodGetWorkflowExecutionStatusRequest{ RunId: "your RunId", } resp, status, err := instance.GetWorkflowExecution(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }
接口请求参数和返回参数详见 OpenAPI:获取工作流执行结果。
package vod import ( "fmt" "testing" "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" ) func Test_GetWorkflowExecutionResult(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.VodGetWorkflowResultRequest{ RunId: "your RunId", } resp, status, err := instance.GetWorkflowExecutionResult(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }