public ActionResult ViewPlayAuth(int id) { JgVideo video = unitOfWork.jgVideosRepository.GetByID(id); if (video == null) { return(HttpNotFound()); } string ApiUrl = AliyunCommonParaConfig.ApiUrl; // 注意这里需要使用UTC时间,比北京时间少8小时。 string Timestamp = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", DateTimeFormatInfo.InvariantInfo); string Action = "GetVideoPlayAuth"; string SignatureNonce = CommonTools.EncryptToSHA1(CommonTools.GenerateRandomNumber(8)); // string VideoId = "6ccf973fe06741e49ab849d4cec017e0"; string VideoId = video.Content; ViewBag.VideoId = VideoId; ViewBag.PlayAuth = AliyunVideoServices.GetVideoInfo(ApiUrl, VideoId, Timestamp, Action, SignatureNonce).PlayAuth; ViewBag.title = "视频"; return(View(video)); }
//项目相关的页面 public ActionResult Program(int id, int bid) { if (Session["CustomerId"] != null) { string ApiUrl = AliyunCommonParaConfig.ApiUrl; // 注意这里需要使用UTC时间,比北京时间少8小时。 string Timestamp = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", DateTimeFormatInfo.InvariantInfo); string Action = "GetVideoPlayAuth"; string SignatureNonce = CommonTools.EncryptToSHA1(CommonTools.GenerateRandomNumber(8)); AdsVideo video = unitOfWork.adsVideosRepository.GetByID(id); string VideoId = video.VideoUrl; ViewBag.babyId = bid; ViewBag.VideoId = VideoId; ViewBag.PlayAuth = AliyunVideoServices.GetVideoInfo(ApiUrl, VideoId, Timestamp, Action, SignatureNonce).PlayAuth; return(View(video)); } else { return(RedirectToAction("Login")); } }
// // GET: /Test/ public ActionResult Index() { string ApiUrl = AliyunCommonParaConfig.ApiUrl; // 注意这里需要使用UTC时间,比北京时间少8小时。 string Timestamp = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", DateTimeFormatInfo.InvariantInfo); string Action = "GetVideoPlayAuth"; string SignatureNonce = CommonTools.EncryptToSHA1(CommonTools.GenerateRandomNumber(8)); string VideoId = "61823886c6614369a10025d6fd4fff07"; VideoInfo videoInfo = AliyunVideoServices.GetVideoInfo(ApiUrl, VideoId, Timestamp, Action, SignatureNonce); ViewBag.PlayAuth = videoInfo.PlayAuth; ViewBag.VideoId = VideoId; return(View()); // return RedirectToAction("Details", "Test", new { VideoId = VideoId, PlayAuth = videoInfo.PlayAuth }); }
//项目相关的页面 public ActionResult FreeHeartServices(int id) { string ApiUrl = AliyunCommonParaConfig.ApiUrl; // 注意这里需要使用UTC时间,比北京时间少8小时。 string Timestamp = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", DateTimeFormatInfo.InvariantInfo); string Action = "GetVideoPlayAuth"; string SignatureNonce = CommonTools.EncryptToSHA1(CommonTools.GenerateRandomNumber(8)); AdsVideo video = unitOfWork.adsVideosRepository.GetByID(id); string VideoId = video.VideoUrl; ViewBag.VideoId = VideoId; ViewBag.PlayAuth = AliyunVideoServices.GetVideoInfo(ApiUrl, VideoId, Timestamp, Action, SignatureNonce).PlayAuth; return(View(video)); }