zoukankan      html  css  js  c++  java
  • 阿里云视频对接后端api代码

        public VideoRequest CreateUploadVideo(string strTitle, string strFileName)
            {
                CreateUploadVideoRequest request = new CreateUploadVideoRequest();
                request.FileName = strFileName;
                request.Title = strTitle;
                DefaultAcsClient client = InitVodClient();
                CreateUploadVideoResponse response = client.GetAcsResponse(request);
                VideoRequest obj = new VideoRequest();
                obj.RequestId= response.RequestId;
                obj.UploadAddress= response.UploadAddress;
                obj.UploadAuth = response.UploadAuth;
                obj.VideoId = response.VideoId;
                return obj;
            }
      
            public string GetPlayInfo(string strVid)
            {
                GetPlayInfoRequest request = new GetPlayInfoRequest();
                request.VideoId = strVid;
                DefaultAcsClient client = InitVodClient();
                GetPlayInfoResponse response = client.GetAcsResponse(request);
                List<GetPlayInfoResponse.GetPlayInfo_PlayInfo> playInfoList = response.PlayInfoList;
                if (playInfoList.Count > 0)
                {
                    return playInfoList[0].PlayURL;
                }
                return string.Empty;
            }
    
            public string GetVideoPlayAuth(string strVid)
            {
                GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest();
                request.VideoId = strVid;
                DefaultAcsClient client = InitVodClient();
                GetVideoPlayAuthResponse response = client.GetAcsResponse(request);
                string strPlayAuth = response.PlayAuth;
                if (string.IsNullOrEmpty(strPlayAuth))
                {
                    return string.Empty;
                }
                return strPlayAuth;
            }
    
            public bool RefreshUploadVideo(string strVid)
            {
                RefreshUploadVideoRequest request = new RefreshUploadVideoRequest();
                request.VideoId = strVid;
                DefaultAcsClient client = InitVodClient();
                RefreshUploadVideoResponse response = client.GetAcsResponse(request);
                return true;
            }       public static DefaultAcsClient InitVodClient()
            {
                String accessKeyId = ";//用于标识用户
                String accessKeySecret = “”;
                // 构建一个 Client,用于发起请求
                string regionId = "cn-shanghai"; //目前仅支持cn-shanghai
                IClientProfile profile = Aliyun.Acs.Core.Profile.DefaultProfile.GetProfile(regionId, accessKeyId, accessKeySecret);
                return new DefaultAcsClient(profile);
            }

    using Aliyun.Acs.Core;
    using Aliyun.Acs.Core.Profile;
    using Aliyun.Acs.vod.Model.V20170321;

    aliyun-net-sdk-core

    aliyun-net-sdk-vod

  • 相关阅读:
    MS CRM 2011 RC中的新特性(4)——活动方面之批量编辑、自定义活动
    最近的一些有关MS CRM 2011的更新
    MS CRM 2011 RC中的新特性(6)——连接
    MS CRM 2011 RC中的新特性(7)—仪表板
    参加MS CRM2011深度培训课程——第一天
    MS CRM 2011插件调试工具
    MS CRM2011实体介绍(四)——目标管理方面的实体
    MS CRM 2011 RC中的新特性(3)——客户服务管理方面
    MS CRM 2011 RC中的新特性(8)—数据管理
    ExtAspNet 登陆
  • 原文地址:https://www.cnblogs.com/xuxian001/p/12868004.html
Copyright © 2011-2022 走看看