zoukankan      html  css  js  c++  java
  • Media Player 嵌套网页中播放上传视频记录 Jimmy

    首先我把Media Player播放器做一个用户控件

    代码如下

    前台:

    View Code
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MedayPlayer.ascx.cs" Inherits="Web.MedayPlayer" %>
    <script language="javascript" type="text/javascript">
    <asp:Literal ID="Literal1" runat="server"></asp:Literal>

    var oeTags = '<object id="mediaPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"'
    + 'width="' + width + '" height="' + height + '"'
    + 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"'
    + 'standby="Loading Microsoft Windows Media Player components..."'
    + 'type="application/x-oleobject">'
    + ' <param name="autoStart" value="false"/>'
    + ' <param name="url" value="' + videolink + '" />'
    + ' <param name="wmode" value="transparent" />'
    + ' <param name="uiMode" value="full" />'
    + ' <param name="loop" value="false" />'
    + ' <embed id ="EmbedmediaPlayer"'
    + ' type ="application/x-mplayer2"'
    + ' src ="' + videolink + '"'
    + ' width ="' + width + '"'
    + ' height ="' + height + '">'
    + ' </embed>'
    + '</object>';
    document.write(oeTags);
    </script>

     后台代码:

    View Code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace Web
    {
    public partial class MedayPlayer : System.Web.UI.UserControl
    {
    private int width;
    private int height;
    private string videolink;

    public int Width
    {
    set
    {
    width = value;
    }
    }

    public int Height
    {
    set
    {
    height = value;
    }
    }

    public string Videolink
    {
    set
    {
    videolink = value;
    }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    this.Literal1.Text = "var width=" + width + ";var height=" + height + ";var videolink='" + videolink + "';";
    }
    }
    }

    调用前台代码:

    View Code
    <%@ Register Src="MedayPlayer.ascx" TagName="MedayPlayer" TagPrefix="uc5" %>
    //头部引用

    <uc5:MedayPlayer ID="MedayPlayer1" runat="server" />
    //网页中嵌套

    调用后台代码:

    View Code
     /// <summary>
    /// 播放视频信息
    /// </summary>
    public void Rpt_bfspBind()
    {

    DataSet ds = new sepco.BLL.hw_room().Getdataset(" type=1 and id="+id);
    title = ds.Tables[0].Rows[0]["title"].ToString();
    uptime = ds.Tables[0].Rows[0]["addtime"].ToString();
    this.MedayPlayer1.Width = 481;
    this.MedayPlayer1.Height = 359;
    this.MedayPlayer1.Videolink = "" + ds.Tables[0].Rows[0]["url"].ToString() + "";
    }




  • 相关阅读:
    iOS开发——Xcode快捷键
    iOS开发——国际化支持Localizable.strings
    SQL 函数
    常用窗体表单布局
    Extjs grid combo
    怎么完全卸载sql2005?
    ExtJS文件上传
    ExtJS视频学习笔记
    ExtJS问题集——Menu的show()和showBy()函数是什么意思
    C# DataGridView操作
  • 原文地址:https://www.cnblogs.com/DemoLee/p/2375809.html
Copyright © 2011-2022 走看看