• 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() + "";
    }




  • 相关阅读:
    舵机驱动-GPIO MG995 STM32
    Ymodem协议-接收
    IAP注意事项
    stm32系统时钟配置,标准库v3.5
    FREERTOS移植(MDK 、STM32F103)
    C语言常量后缀
    回调函数
    运算符记忆口诀
    C语言函数指针
    frp 搭建内网穿透
  • 原文地址:https://www.cnblogs.com/DemoLee/p/2375809.html
Copyright © 2020-2023  润新知