代码拉取完成,页面将自动刷新
// Copyright (c) 2017-2025 Tencent. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v20220110
import (
"context"
"errors"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
)
const APIVersion = "2022-01-10"
type Client struct {
common.Client
}
// Deprecated
func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
cpf := profile.NewClientProfile()
client = &Client{}
client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
return
}
func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
client = &Client{}
client.Init(region).
WithCredential(credential).
WithProfile(clientProfile)
return
}
func NewApplyConcurrentRequest() (request *ApplyConcurrentRequest) {
request = &ApplyConcurrentRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("car", APIVersion, "ApplyConcurrent")
return
}
func NewApplyConcurrentResponse() (response *ApplyConcurrentResponse) {
response = &ApplyConcurrentResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// ApplyConcurrent
// 本接口用于申请并发。接口超时时间:20秒。
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// FAILEDOPERATION_PROCESSTIMEOUT = "FailedOperation.ProcessTimeout"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// INVALIDPARAMETERVALUE = "InvalidParameterValue"
// RESOURCENOTFOUND_NOIDLE = "ResourceNotFound.NoIdle"
// RESOURCEUNAVAILABLE_INITIALIZATION = "ResourceUnavailable.Initialization"
// UNSUPPORTEDOPERATION_STOPPING = "UnsupportedOperation.Stopping"
func (c *Client) ApplyConcurrent(request *ApplyConcurrentRequest) (response *ApplyConcurrentResponse, err error) {
return c.ApplyConcurrentWithContext(context.Background(), request)
}
// ApplyConcurrent
// 本接口用于申请并发。接口超时时间:20秒。
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// FAILEDOPERATION_PROCESSTIMEOUT = "FailedOperation.ProcessTimeout"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// INVALIDPARAMETERVALUE = "InvalidParameterValue"
// RESOURCENOTFOUND_NOIDLE = "ResourceNotFound.NoIdle"
// RESOURCEUNAVAILABLE_INITIALIZATION = "ResourceUnavailable.Initialization"
// UNSUPPORTEDOPERATION_STOPPING = "UnsupportedOperation.Stopping"
func (c *Client) ApplyConcurrentWithContext(ctx context.Context, request *ApplyConcurrentRequest) (response *ApplyConcurrentResponse, err error) {
if request == nil {
request = NewApplyConcurrentRequest()
}
c.InitBaseRequest(&request.BaseRequest, "car", APIVersion, "ApplyConcurrent")
if c.GetCredential() == nil {
return nil, errors.New("ApplyConcurrent require credential")
}
request.SetContext(ctx)
response = NewApplyConcurrentResponse()
err = c.Send(request, response)
return
}
func NewCreateSessionRequest() (request *CreateSessionRequest) {
request = &CreateSessionRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("car", APIVersion, "CreateSession")
return
}
func NewCreateSessionResponse() (response *CreateSessionResponse) {
response = &CreateSessionResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// CreateSession
// 本接口用于创建会话。接口超时时间:5秒。
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// FAILEDOPERATION_LOCKTIMEOUT = "FailedOperation.LockTimeout"
// FAILEDOPERATION_PATHNOTFOUND = "FailedOperation.PathNotFound"
// FAILEDOPERATION_PROCESSTIMEOUT = "FailedOperation.ProcessTimeout"
// FAILEDOPERATION_SLOWDOWN = "FailedOperation.SlowDown"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// INVALIDPARAMETERVALUE = "InvalidParameterValue"
// LIMITEXCEEDED_ROLE = "LimitExceeded.Role"
// OPERATIONDENIED = "OperationDenied"
// RESOURCENOTFOUND_NOIDLE = "ResourceNotFound.NoIdle"
// RESOURCENOTFOUND_SESSIONNOTFOUND = "ResourceNotFound.SessionNotFound"
// RESOURCEUNAVAILABLE_INITIALIZATION = "ResourceUnavailable.Initialization"
// UNSUPPORTEDOPERATION_STOPPING = "UnsupportedOperation.Stopping"
func (c *Client) CreateSession(request *CreateSessionRequest) (response *CreateSessionResponse, err error) {
return c.CreateSessionWithContext(context.Background(), request)
}
// CreateSession
// 本接口用于创建会话。接口超时时间:5秒。
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// FAILEDOPERATION_LOCKTIMEOUT = "FailedOperation.LockTimeout"
// FAILEDOPERATION_PATHNOTFOUND = "FailedOperation.PathNotFound"
// FAILEDOPERATION_PROCESSTIMEOUT = "FailedOperation.ProcessTimeout"
// FAILEDOPERATION_SLOWDOWN = "FailedOperation.SlowDown"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// INVALIDPARAMETERVALUE = "InvalidParameterValue"
// LIMITEXCEEDED_ROLE = "LimitExceeded.Role"
// OPERATIONDENIED = "OperationDenied"
// RESOURCENOTFOUND_NOIDLE = "ResourceNotFound.NoIdle"
// RESOURCENOTFOUND_SESSIONNOTFOUND = "ResourceNotFound.SessionNotFound"
// RESOURCEUNAVAILABLE_INITIALIZATION = "ResourceUnavailable.Initialization"
// UNSUPPORTEDOPERATION_STOPPING = "UnsupportedOperation.Stopping"
func (c *Client) CreateSessionWithContext(ctx context.Context, request *CreateSessionRequest) (response *CreateSessionResponse, err error) {
if request == nil {
request = NewCreateSessionRequest()
}
c.InitBaseRequest(&request.BaseRequest, "car", APIVersion, "CreateSession")
if c.GetCredential() == nil {
return nil, errors.New("CreateSession require credential")
}
request.SetContext(ctx)
response = NewCreateSessionResponse()
err = c.Send(request, response)
return
}
func NewDestroySessionRequest() (request *DestroySessionRequest) {
request = &DestroySessionRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("car", APIVersion, "DestroySession")
return
}
func NewDestroySessionResponse() (response *DestroySessionResponse) {
response = &DestroySessionResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// DestroySession
// 销毁会话。如果该会话开启了云端推流,那么销毁会话时会结束云端推流。
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// FAILEDOPERATION_PROCESSTIMEOUT = "FailedOperation.ProcessTimeout"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// RESOURCEUNAVAILABLE_ACCESSFAILED = "ResourceUnavailable.AccessFailed"
func (c *Client) DestroySession(request *DestroySessionRequest) (response *DestroySessionResponse, err error) {
return c.DestroySessionWithContext(context.Background(), request)
}
// DestroySession
// 销毁会话。如果该会话开启了云端推流,那么销毁会话时会结束云端推流。
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// FAILEDOPERATION_PROCESSTIMEOUT = "FailedOperation.ProcessTimeout"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// RESOURCEUNAVAILABLE_ACCESSFAILED = "ResourceUnavailable.AccessFailed"
func (c *Client) DestroySessionWithContext(ctx context.Context, request *DestroySessionRequest) (response *DestroySessionResponse, err error) {
if request == nil {
request = NewDestroySessionRequest()
}
c.InitBaseRequest(&request.BaseRequest, "car", APIVersion, "DestroySession")
if c.GetCredential() == nil {
return nil, errors.New("DestroySession require credential")
}
request.SetContext(ctx)
response = NewDestroySessionResponse()
err = c.Send(request, response)
return
}
func NewStartPublishStreamRequest() (request *StartPublishStreamRequest) {
request = &StartPublishStreamRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("car", APIVersion, "StartPublishStream")
return
}
func NewStartPublishStreamResponse() (response *StartPublishStreamResponse) {
response = &StartPublishStreamResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// StartPublishStream
// 开始云端推流。云端推流 codec 根据客户端(SDK)能力来自动选择,默认优先顺序为 H265、H264、VP8、VP9。
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER = "InvalidParameter"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// OPERATIONDENIED = "OperationDenied"
// RESOURCENOTFOUND_SESSIONNOTFOUND = "ResourceNotFound.SessionNotFound"
func (c *Client) StartPublishStream(request *StartPublishStreamRequest) (response *StartPublishStreamResponse, err error) {
return c.StartPublishStreamWithContext(context.Background(), request)
}
// StartPublishStream
// 开始云端推流。云端推流 codec 根据客户端(SDK)能力来自动选择,默认优先顺序为 H265、H264、VP8、VP9。
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER = "InvalidParameter"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// OPERATIONDENIED = "OperationDenied"
// RESOURCENOTFOUND_SESSIONNOTFOUND = "ResourceNotFound.SessionNotFound"
func (c *Client) StartPublishStreamWithContext(ctx context.Context, request *StartPublishStreamRequest) (response *StartPublishStreamResponse, err error) {
if request == nil {
request = NewStartPublishStreamRequest()
}
c.InitBaseRequest(&request.BaseRequest, "car", APIVersion, "StartPublishStream")
if c.GetCredential() == nil {
return nil, errors.New("StartPublishStream require credential")
}
request.SetContext(ctx)
response = NewStartPublishStreamResponse()
err = c.Send(request, response)
return
}
func NewStartPublishStreamWithURLRequest() (request *StartPublishStreamWithURLRequest) {
request = &StartPublishStreamWithURLRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("car", APIVersion, "StartPublishStreamWithURL")
return
}
func NewStartPublishStreamWithURLResponse() (response *StartPublishStreamWithURLResponse) {
response = &StartPublishStreamWithURLResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// StartPublishStreamWithURL
// 开始云端推流到指定URL。云端推流 codec 根据客户端(SDK)能力来自动选择,默认优先顺序为 H265、H264、VP8、VP9。该推流方式需要单独计费,详细计费方式请查看[指定地址推流费用说明](https://cloud.tencent.com/document/product/1547/72168#98ac188a-d122-4caf-88be-05268ecefdf6)
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER = "InvalidParameter"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// OPERATIONDENIED = "OperationDenied"
// RESOURCENOTFOUND_SESSIONNOTFOUND = "ResourceNotFound.SessionNotFound"
func (c *Client) StartPublishStreamWithURL(request *StartPublishStreamWithURLRequest) (response *StartPublishStreamWithURLResponse, err error) {
return c.StartPublishStreamWithURLWithContext(context.Background(), request)
}
// StartPublishStreamWithURL
// 开始云端推流到指定URL。云端推流 codec 根据客户端(SDK)能力来自动选择,默认优先顺序为 H265、H264、VP8、VP9。该推流方式需要单独计费,详细计费方式请查看[指定地址推流费用说明](https://cloud.tencent.com/document/product/1547/72168#98ac188a-d122-4caf-88be-05268ecefdf6)
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER = "InvalidParameter"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// OPERATIONDENIED = "OperationDenied"
// RESOURCENOTFOUND_SESSIONNOTFOUND = "ResourceNotFound.SessionNotFound"
func (c *Client) StartPublishStreamWithURLWithContext(ctx context.Context, request *StartPublishStreamWithURLRequest) (response *StartPublishStreamWithURLResponse, err error) {
if request == nil {
request = NewStartPublishStreamWithURLRequest()
}
c.InitBaseRequest(&request.BaseRequest, "car", APIVersion, "StartPublishStreamWithURL")
if c.GetCredential() == nil {
return nil, errors.New("StartPublishStreamWithURL require credential")
}
request.SetContext(ctx)
response = NewStartPublishStreamWithURLResponse()
err = c.Send(request, response)
return
}
func NewStopPublishStreamRequest() (request *StopPublishStreamRequest) {
request = &StopPublishStreamRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("car", APIVersion, "StopPublishStream")
return
}
func NewStopPublishStreamResponse() (response *StopPublishStreamResponse) {
response = &StopPublishStreamResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// StopPublishStream
// 停止云端推流
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER = "InvalidParameter"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// OPERATIONDENIED = "OperationDenied"
// RESOURCENOTFOUND_SESSIONNOTFOUND = "ResourceNotFound.SessionNotFound"
func (c *Client) StopPublishStream(request *StopPublishStreamRequest) (response *StopPublishStreamResponse, err error) {
return c.StopPublishStreamWithContext(context.Background(), request)
}
// StopPublishStream
// 停止云端推流
//
// 可能返回的错误码:
// FAILEDOPERATION = "FailedOperation"
// INTERNALERROR = "InternalError"
// INVALIDPARAMETER = "InvalidParameter"
// INVALIDPARAMETER_JSONPARSEERROR = "InvalidParameter.JsonParseError"
// OPERATIONDENIED = "OperationDenied"
// RESOURCENOTFOUND_SESSIONNOTFOUND = "ResourceNotFound.SessionNotFound"
func (c *Client) StopPublishStreamWithContext(ctx context.Context, request *StopPublishStreamRequest) (response *StopPublishStreamResponse, err error) {
if request == nil {
request = NewStopPublishStreamRequest()
}
c.InitBaseRequest(&request.BaseRequest, "car", APIVersion, "StopPublishStream")
if c.GetCredential() == nil {
return nil, errors.New("StopPublishStream require credential")
}
request.SetContext(ctx)
response = NewStopPublishStreamResponse()
err = c.Send(request, response)
return
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。