Exemplo n.º 1
0
        /// <summary>
        ///  获取视频播放的凭证信息,加密播放。
        /// </summary>
        /// <param name="input">参数:https://help.aliyun.com/document_detail/52833.html?spm=a2c4g.11186623.2.15.140f6872F2JNHX</param>
        public GetVideoPlayAuthResponse GetVideoPlayAuth(GetVideoPlayAuthRequest input)
        {
            var client   = InitVodClient();
            var response = client.GetAcsResponse(input);

            return(response);
        }
        public async Task <VideoPlayAuthDto> GetVideoResourcePlayAuth(EntityDto <string> videoInput)
        {
            var entity = await _videoResourceRepo.FirstOrDefaultAsync(a => a.VideoId == videoInput.Id);

            var input = new GetVideoPlayAuthRequest();

            if (entity.Duration.HasValue && entity.Duration < 3000)
            {
                var duration = Convert.ToInt32(entity.Duration.Value);
                input.AuthInfoTimeout = duration;
            }
            else
            {
                input.AuthInfoTimeout = 3000;
            }

            input.VideoId = entity.VideoId;

            var res = _aliyunVodManager.GetVideoPlayAuth(input);

            var dto = new VideoPlayAuthDto
            {
                CoverURL = res.VideoMeta.CoverURL,
                VideoId  = res.VideoMeta.VideoId,
                PlayAuth = res.PlayAuth
            };

            //dto.VideoMeta.Title
            //dto.VideoMeta.VideoId
            //     dto.PlayAuth 50分钟。

            return(dto);
        }
        public ActionResult Play(string id)
        {
            GetVideoPlayAuthRequest resp = new GetVideoPlayAuthRequest();

            resp.VideoId = id;
            ViewBag.info = aliServer.GetVideoPlayAuth(resp);
            return(View());
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取视频播放凭证
        /// </summary>
        /// <param name="videoId"></param>
        /// <param name="authTimeout"></param>
        /// <returns></returns>
        public GetVideoPlayAuthResponse GetVideoPlayAuth(string videoId, int authTimeout = 3000)
        {
            var request = new GetVideoPlayAuthRequest();

            request.VideoId         = videoId;
            request.AuthInfoTimeout = authTimeout;
            request.RegionId        = RegionId;
            return(Client.GetAcsResponse(request));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取视频播放凭证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public GetVideoPlayAuthResponse GetVideoPlayAuth(GetVideoPlayAuthRequest request)
        {
            GetVideoPlayAuthResponse response = new GetVideoPlayAuthResponse();

            try
            {
                response = acsClient.GetAcsResponse(request);
            }
            catch (Exception ex)
            {
            }
            return(response);
        }