protected void Page_Load(object sender, EventArgs e) { VideoLiveBLL vlb = new VideoLiveBLL(); VideoLiveInfo vli = vlb.FindMaxVideo(); Response.Write(vli.LiveVideoUrl); }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Response.Redirect("Login.aspx"); } int.TryParse(Request.QueryString["p"], out _page); _page = _page < 1 ? 1 : _page; VideoInfoBLL vib = new VideoInfoBLL(); video_rpt.DataSource = vib.FindAllVideo(_page, _pagesize, out _count); page_str.Text = CreatePageList("videopage", _pagesize, _count, _page, out _total_page); page_hide.Text = _page.ToString(); //初始化查询直播路径 VideoLiveBLL vlb = new VideoLiveBLL(); VideoLiveInfo vli = vlb.FindMaxVideo(); if (string.IsNullOrEmpty(vli.LiveVideoUrl)) { //如果为空就添加操作 url_status = "insert"; live_url_hide.Text = ""; } else { live_url_hide.Text = vli.LiveVideoUrl; //否则修改操作 url_status = "update"; } Page.DataBind(); }
string contor = ConfigurationManager.ConnectionStrings["sql"].ConnectionString; // private VideoLiveInfo SetRow(SqlDataReader rd) //获取一行的数据 { VideoLiveInfo row = new VideoLiveInfo(); row.Id = rd["id"].ToString(); row.LiveVideoUrl = rd["live_video_url"].ToString(); return(row); }
//查询id最大的一条数据 public VideoLiveInfo FindMaxVideo() { string sql = "select * from dbo.VideoLive where id = (select MAX(id) from VideoLive)"; VideoLiveInfo vli = new VideoLiveInfo(); using (SqlDataReader rd = SqlHelper.ExecuteReader(contor, CommandType.Text, sql, null)) { if (rd.Read()) { vli = SetRow(rd); } return(vli); } }
protected void Page_Load(object sender, EventArgs e) //usercode { usercode = Request.QueryString["usercode"]; if (!IsPostBack) { EJUWebService.UCWebService ejuws = new EJUWebService.UCWebService(); returnbk.Visible = false; //if (!(ejuws.CheckLogin(usercode))) //{ // Response.Redirect("http://in.eju.com"); //} //else //{ #region this.litreturnzhibo.Text = "<a href=\"WatchVideo.aspx?usercode=" + usercode + "\">回到直播</a>"; int.TryParse(Request.QueryString["p"], out _page); _page = _page < 1 ? 1 : _page; VideoInfoBLL vib = new VideoInfoBLL(); List <VideoInfo> list = null; list = vib.FindAllVideo(_page, _pagesize, out _count); if (list != null && list.Count > 0) { video_rpt.DataSource = list; page_str.Text = CreatePageList("videopage", _pagesize, _count, _page, out _total_page); page_hide.Text = _page.ToString(); } else { this.litMsg.Text = "暂无视频"; } //查询初始路径 VideoLiveBLL vlb = new VideoLiveBLL(); VideoLiveInfo vli = vlb.FindMaxVideo(); //Response.Write(vli.LiveVideoUrl); string id = Request.QueryString["id"]; #region 拼接js //第一次登陆 if (string.IsNullOrEmpty(id)) { sb.Append("jwplayer('mediaspace').setup({"); sb.Append(" 'screencolor':'FFFFFF',"); sb.Append(" 'flashplayer': 'player.swf',"); sb.Append(" 'file': 'livestream1',"); sb.Append(" 'image': 'image/eju.png',"); sb.Append("'streamer': '" + vli.LiveVideoUrl + "',"); sb.Append("'controlbar': 'bottom',"); sb.Append("'width': '556',"); sb.Append(" 'height': '384',"); sb.Append(" 'stretching':'fill' "); sb.Append("});"); } else { returnbk.Visible = true; //根据id查询 VideoInfo vi = vib.FindOneVideo(id); meet_time.Text = FormatDate(vi.VideoTime); meet_top.Text = vi.VideoTitle; string filename = vi.VideoUrl.Substring(vi.VideoUrl.LastIndexOf("/") + 1); sb.Append("jwplayer('mediaspace').setup({"); sb.Append(" 'screencolor':'FFFFFF',"); sb.Append(" 'flashplayer': 'player.swf',"); sb.Append(" 'file': '" + filename + "',"); sb.Append(" 'image': 'image/eju.png',"); int fileindex = vi.VideoUrl.LastIndexOf("/"); sb.Append("'streamer': '" + vi.VideoUrl.Substring(0, fileindex) + "',"); sb.Append("'controlbar': 'bottom',"); sb.Append("'width': '556',"); sb.Append(" 'height': '384',"); sb.Append("'stretching':'fill'"); sb.Append("});"); } #endregion Page.DataBind(); #endregion //} } }