none
embeding multiple videos on the same player using C# RRS feed

  • Question

  • how i can play multiple videos that are in a gridview in the same player using asp.net? anyone can help me ?
    Saturday, August 16, 2014 4:55 PM

Answers

  • You've given us nothing to go on - what kind of player, what kind of video, and what does C# have to do with the function of a video player, what do you mean by multiple videos in the same player (a playlist?), etc. - but this is not a question for Expression Web.  It's a question for the provider of whatever video player you are using and for the asp.net forum if there is something about asp.net to do with how you are using that player.

    The asp.net forum is at http://forums.asp.net/ .  (They will want a much more detailed description of your question.)

    • Edited by KathyW2 Saturday, August 16, 2014 10:15 PM
    • Marked as answer by rizwana.batool Sunday, August 17, 2014 7:28 PM
    Saturday, August 16, 2014 6:09 PM
  • As Kathy has pointed out, you have provided far too little information to offer specific guidance. The simple, generic recommendation would be to simply use a loop structure (e.g. for/for each, while) to loop through the GridView's rows and play the files listed there. And that's about it for what we can offer without more information.

    If you're not sure how to write the C# to implement such a structure, or about other elements of ASP.NET, then you definitely need to check out the ASP.NET forum for tutorials and advice. This forum is focused on EW, and while it does offer some limited support for ASP.NET, we here usually direct people to the much more focused ASP.NET forum.

    cheers,
    scott


    Please remember to "Mark as Answer" the responses that resolved your issue. It is common courtesy to recognize those who have helped you, and it also makes it easier for visitors to find the resolution later.

    Saturday, August 16, 2014 11:11 PM
  • ASP.NET is a Web based Framework, where you work with HTML more than C# and you can even use some built-in functions of ASP.NET to play videos.

    The videos are played using either Flash player, or by using the HTML5 video player, whose code is as

    <video src="videofile.ogg">
      Sorry, your browser doesn't support embedded videos, 
      but don't worry, you can <a href="videofile.ogg">download it</a>
      and watch it with your favorite video player!
    </video>

    ..somehow, ASP.NET won't control when you'll be playing multiple videos. ASP.NET can pass the entire data to the client and then you'll have to manage it on the client side. ASP.NET can work with HTTP requests only. 

    You need to learn the video tag of the HTML5 and how you can work with it, that way you can pass the data though ASP.NET and then use it in the client side data and play the media inside this element using the data that was passed down to the browser. But remember, you can play only one media at a time. You will be required to remove one media and start the next one or have multiple video elements inside the document.

    https://developer.mozilla.org/en/docs/Web/HTML/Element/video


    ~!Firewall!~

    Saturday, August 16, 2014 11:25 PM
  • Don't do it!

    Use what YouTube does, (if you're not in Pakistan; Rizwana => Origin = Pakistan), go to YouTube and have a look what they actually do. You can see that they're having a single data with the name of watch. Each time user navigates to that page, he has an extra query string (watch?v=idD53Hd; v is the query string) that is actually the ID of the video that you're watching. 

    They create a single video player and play each video on it. You need to load the data depending on some condition. YouTube guys, use the video ID as the condition and load the data for that video only and leave remaining objects as they are. 

    You can do the same, just build a single page where you will load the data for the videos, and each time the user comes there, try to append the video URL to the request or to the URL and then use that ID to extract the video and load it in the HTML. 

    No need to worry, this is not a hard task, you just need to try it out. If it doesn't work, try again!

    You will succeed :) Good luck sister.


    ~!Firewall!~

    Sunday, August 17, 2014 7:23 PM

All replies

  • You've given us nothing to go on - what kind of player, what kind of video, and what does C# have to do with the function of a video player, what do you mean by multiple videos in the same player (a playlist?), etc. - but this is not a question for Expression Web.  It's a question for the provider of whatever video player you are using and for the asp.net forum if there is something about asp.net to do with how you are using that player.

    The asp.net forum is at http://forums.asp.net/ .  (They will want a much more detailed description of your question.)

    • Edited by KathyW2 Saturday, August 16, 2014 10:15 PM
    • Marked as answer by rizwana.batool Sunday, August 17, 2014 7:28 PM
    Saturday, August 16, 2014 6:09 PM
  • As Kathy has pointed out, you have provided far too little information to offer specific guidance. The simple, generic recommendation would be to simply use a loop structure (e.g. for/for each, while) to loop through the GridView's rows and play the files listed there. And that's about it for what we can offer without more information.

    If you're not sure how to write the C# to implement such a structure, or about other elements of ASP.NET, then you definitely need to check out the ASP.NET forum for tutorials and advice. This forum is focused on EW, and while it does offer some limited support for ASP.NET, we here usually direct people to the much more focused ASP.NET forum.

    cheers,
    scott


    Please remember to "Mark as Answer" the responses that resolved your issue. It is common courtesy to recognize those who have helped you, and it also makes it easier for visitors to find the resolution later.

    Saturday, August 16, 2014 11:11 PM
  • ASP.NET is a Web based Framework, where you work with HTML more than C# and you can even use some built-in functions of ASP.NET to play videos.

    The videos are played using either Flash player, or by using the HTML5 video player, whose code is as

    <video src="videofile.ogg">
      Sorry, your browser doesn't support embedded videos, 
      but don't worry, you can <a href="videofile.ogg">download it</a>
      and watch it with your favorite video player!
    </video>

    ..somehow, ASP.NET won't control when you'll be playing multiple videos. ASP.NET can pass the entire data to the client and then you'll have to manage it on the client side. ASP.NET can work with HTTP requests only. 

    You need to learn the video tag of the HTML5 and how you can work with it, that way you can pass the data though ASP.NET and then use it in the client side data and play the media inside this element using the data that was passed down to the browser. But remember, you can play only one media at a time. You will be required to remove one media and start the next one or have multiple video elements inside the document.

    https://developer.mozilla.org/en/docs/Web/HTML/Element/video


    ~!Firewall!~

    Saturday, August 16, 2014 11:25 PM
  • this is my code of uploading a file

    aspxfile

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="dld video insert.aspx.cs" Inherits="dld_video_insert" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> &nbsp;&nbsp; VideoName<br /> <br /> <asp:FileUpload ID="FileUpload1" runat="server" /> <br /> <asp:Label ID="Label1" runat="server"></asp:Label> <br /> <br /> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Upload" /> <br /> </div> </form> </body> </html>


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
    public partial class dld_video_insert : System.Web.UI.Page
    {
         SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["videoConnectionString"].ConnectionString);
        protected void Page_Load(object sender, EventArgs e)
        {
           
    
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                string str = FileUpload1.FileName;
                FileUpload1.PostedFile.SaveAs(Server.MapPath(".") + "//Data//" + str);
                string path = "~/Data/" + str.ToString();
                SqlCommand cmd = new SqlCommand("insert into dld1 values('" + TextBox1.Text + "','" + path + "')", con);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
                Label1.Text = "Uploaded";
            }
        }
    }
    files uploaded in a gridview
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="dld lec.aspx.cs" Inherits="dld_lec" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="219px">
                <Columns>
                    <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True" SortExpression="id" />
                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                    <asp:TemplateField HeaderText="Play Videos">
                        <ItemTemplate>
                            <a href="subjects.aspx">
                            Click to Play
                                </a>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:videoConnectionString %>" SelectCommand="SELECT * FROM [dld1]"></asp:SqlDataSource>
        
        </div>
        </form>
    </body>
    </html>
    

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
    public partial class dld_lec : System.Web.UI.Page
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["videoConnectionString"].ConnectionString);
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
    
        }
    }
    now the problem is that i have to play video files that are uploaded in a gridview in a single media player. i   have choice of making seperate page for every video and then link them behind that video. bt  i want to play all these videos in a single page and single player.please quote me your best advice. 
    Sunday, August 17, 2014 7:10 PM
  • sorry for being here and providing very short information, because i thought there will be no response like other sites. but i am grateful to you for guiding me. 
    Sunday, August 17, 2014 7:14 PM
  • Don't do it!

    Use what YouTube does, (if you're not in Pakistan; Rizwana => Origin = Pakistan), go to YouTube and have a look what they actually do. You can see that they're having a single data with the name of watch. Each time user navigates to that page, he has an extra query string (watch?v=idD53Hd; v is the query string) that is actually the ID of the video that you're watching. 

    They create a single video player and play each video on it. You need to load the data depending on some condition. YouTube guys, use the video ID as the condition and load the data for that video only and leave remaining objects as they are. 

    You can do the same, just build a single page where you will load the data for the videos, and each time the user comes there, try to append the video URL to the request or to the URL and then use that ID to extract the video and load it in the HTML. 

    No need to worry, this is not a hard task, you just need to try it out. If it doesn't work, try again!

    You will succeed :) Good luck sister.


    ~!Firewall!~

    Sunday, August 17, 2014 7:23 PM
  • Again, please post asp.net questions to the asp.net forum. Do not post asp.net markup here. (They will be happy to look at your markup on the asp.net forum.)  If you know how to do things in asp.net, there would be no need to post markup.  If you need to ask questions about doing things in asp.net beyond setting basic properties on controls, ask on the asp.net forum:

    http://forums.asp.net/

    Sunday, August 17, 2014 8:28 PM