Exemplo n.º 1
0
        public ActionResult ViewPlayUrl(int id)
        {
            JgVideo video = unitOfWork.jgVideosRepository.GetByID(id);


            string ApiUrl = AliyunCommonParaConfig.ApiUrl;
            // 注意这里需要使用UTC时间,比北京时间少8小时。
            string Timestamp      = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ", DateTimeFormatInfo.InvariantInfo);
            string Action         = "GetPlayInfo";
            string SignatureNonce = CommonTools.EncryptToSHA1(CommonTools.GenerateRandomNumber(8));


            string VideoId = video.Content;

            ViewBag.VideoId = VideoId;
            VideoUrlInfo videoUrlfo = new VideoUrlInfo();

            videoUrlfo = AliyunVideoServices.VideoUrlInfo(ApiUrl, VideoId, Timestamp, Action, SignatureNonce);

            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string strjson = js.Serialize(new { video = video, videoUrlfo = videoUrlfo });//将对象序列化成JSON字符串。匿名类。向浏览器返回多个JSON对象。

            ////  string json = JsonHelper.JsonSerializerBySingleData(videoUrlfo);
            //return Content(strjson);

            ViewBag.playurl = videoUrlfo.PlayInfoList.PlayInfo[1].PlayURL;
            ViewBag.strjson = strjson;
            return(View(video));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        //项目相关的页面
        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"));
            }
        }
Exemplo n.º 4
0
        //
        // 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 });
        }
Exemplo n.º 5
0
        //项目相关的页面
        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));
        }