0

我尝试将 Flow Player 集成到 Ext.net 中。如何在代码(.cs 文件)中设置视频源。

<ext:Panel ID="VideoPanel" runat="server" Split="true">
<Content>
          <div class="flowplayer">
               <video src="../video/Ganesh.mp4"></video>
          </div>
 </Content>
 </ext:Panel> 

我可以通过代码(.cs 文件)添加视频源吗

我在我的广播页面中使用视频。它在表单面板中使用

我的 ASPX 代码是:-----

<ext:FormPanel 
                    ID="FormPanel1" 
                    runat="server" 
                    Region="East" Title="Broadcasting Details"
                    Split="true"
                    Margins="0 5 5 5"
                    Frame="true" ColumnWidth="0.3" 
                    Width="280"
                    DefaultAnchor="100%">
                    <Items>
                        <ext:TextField ID="TextTitle" runat="server" FieldLabel="Title" Name="title" />
                        <ext:TextField ID="TextShortDescription" runat="server" FieldLabel="Short Description" Name="shortDescription" />
                        <ext:Label ID="descriptionLabel" Text="Description" runat="server"></ext:Label>
                        <ext:HtmlEditor ID="TextDescription" Name="descriptionContent" runat="server">
                        </ext:HtmlEditor>
                        <ext:Checkbox ID="CheckIsPublic" runat="server" FieldLabel="IsPublic" Name="isPublic" />
                        <ext:Panel runat="server" Layout="HBoxLayout" Split="true" Frame="true">
                            <Items>
                                <ext:Checkbox ID="CheckisEmbedded" runat="server" FieldLabel="Is Embedded" Name="isEmbedded">
                                   <Listeners>
                                        <Change Fn="changeText" />
                                   </Listeners> 
                                </ext:Checkbox>
                                <ext:ToolbarFill ID="ToolbarFill2" runat="server"></ext:ToolbarFill>
                                <ext:TextField ID="TextEmbeddedCode" runat="server" Name="embeddedCode" Region="West">
                                    <Listeners>
                                        <Change Fn="isFromOtherSite_Checked" />
                                    </Listeners>
                              </ext:TextField>

                            </Items>
                        </ext:Panel>
                        <ext:Panel ID="VideoPanel" runat="server" Split="true">
                            <Content>
                                    <div runat="server" id="videoDiv" class="flowplayer">
                                       <video runat="server" id="video1" ></video>
                                    </div>
                            </Content>
                       </ext:Panel>

                        <ext:FileUploadField ID="fileUploadBroadCast" runat="server" FieldLabel="Broadcast File" Name="fileName" Hidden="false" />
                        <ext:Hidden ID="newsIdHidden" runat="server" Name="broadcastingId" />
                    </Items>
                    <BottomBar>
                        <ext:Toolbar ID="Toolbar2" runat="server">
                        <Items>
                            <ext:Button ID="Button1" runat="server" Text="Save" Icon="Tick">
                               <DirectEvents>
                                    <Click OnEvent="SaveButton_Click"></Click>
                                </DirectEvents>
                            </ext:Button>
                            <ext:Button ID="Button2" runat="server" Text="Reset Fields" Icon="Reload">
                                <DirectEvents>
                                    <Click OnEvent="Reset_Click"></Click>
                                </DirectEvents>
                            </ext:Button>

                            <ext:Button ID="Button3" runat="server" Text="Delete" Icon="Decline">
                                <DirectEvents>
                                    <Click OnEvent="Delete_Click"></Click>
                                </DirectEvents>
                            </ext:Button>
                        </Items>
                        </ext:Toolbar>
                    </BottomBar>
                </ext:FormPanel>

并在directevent方法中设置src,这段代码是:

protected void Select(object sender, DirectEventArgs e)
{
            this.Video1.Attributes.Add("src", "Ganesh.mp4");
}
4

2 回答 2

1

如果添加 runat="server" 属性和 .ID,您应该能够设置其他属性。

例子

<%@ Page Language="C#" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Video1.Attributes.Add("src", "http://example.com/");
    }
</script>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Example</title>
</head>
<body>
    <form runat="server">
        <video ID="Video1" runat="server"></video>
    </form>
</body>
</html>

希望这可以帮助。

于 2012-12-15T10:41:53.553 回答
1

试试这个:

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        videoSrc.Attributes.Add("src", "http://stream.flowplayer.org/bauhaus/624x260.webm");
    }

    protected void ButtonClick(object sender, DirectEventArgs e)
    {
        X.AddScript("flowplayer().load('http://stream.flowplayer.org/bauhaus/624x260.webm')");
    }
</script>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Ext.NET Examples</title>
    <!-- player skin -->
   <link rel="stylesheet" type="text/css" href="flowplayer/skin/minimalist.css" />

   <!-- site specific styling -->
   <style>
   body { font: 12px "Myriad Pro", "Lucida Grande", sans-serif; text-align: center; padding-top: 5%; }
   .flowplayer { width: 80%; }
   </style>

    <!-- flowplayer depends on jQuery 1.7.1+ (for now) -->
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

   <!-- include flowplayer -->
   <script src="flowplayer/flowplayer.min.js"></script>
</head>
<body>
    <ext:ResourceManager runat="server" SourceFormatting="True" ScriptMode="Debug" />

    <ext:Panel runat="server">
        <Content>
            <div class="flowplayer" data-swf="flowplayer.swf" data-ratio="0.417">
              <video runat="server" ID="video">
                 <source ID="videoSrc" runat="server" type="video/webm" />
              </video>
           </div>
        </Content>
    </ext:Panel>

    <ext:Button runat="server" OnDirectClick="ButtonClick" Text="Change video"></ext:Button>
</body>
</html>
于 2012-12-20T07:53:07.363 回答