Problem with media player

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vj4u
    New Member
    • Apr 2010
    • 12

    Problem with media player

    Hi, my media player is not working i have imported dll of windows player. And i have a folder name called upload in my application itself.In the first button i will upload the audio and in the second button im getting the filename using session and using it in the second button when ever i click second button media player is getting disappeared and im getting the fullpath with filename in the second button dont know why media player getting disappeared and i want this website too host also please help its very urgent.


    Code:
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sr = Server.MapPath("./upload/");
        if (FileUpload1.HasFile)
            try
            {
                FileUpload1.SaveAs(Server.MapPath("./upload/") +
                     FileUpload1.FileName);
                Label1.Text = "File name: " +
                     FileUpload1.PostedFile.FileName + "<br>" +
                     FileUpload1.PostedFile.ContentLength + " kb<br>" +
                     "Content type: " +
                     FileUpload1.PostedFile.ContentType;
                Session["v"] = FileUpload1.PostedFile.FileName;
            }
            catch (Exception ex)
            {
                Label1.Text = "ERROR: " + ex.Message.ToString();
            }
        else
        {
            Label1.Text = "You have not specified a file.";
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        string dr1 = Session["v"].ToString();
        string dr2 = Server.MapPath("./upload/" + dr1);
        MediaPlayer1.Filename = dr2;
    }
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Um, Is this an ASP.NET application?

    If it is...do your realize that your C# code is executed on the Server?

    -Frinny

    Comment

    • vj4u
      New Member
      • Apr 2010
      • 12

      #3
      yes please it is asp.net application i can execute this in my local system but i belive that it may not work when i host the web site please help it is very urgent

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Find a free media player flash object (there must be dozens by now) and use that.
        Or is that what MediaPlayer1 is? It needs to be a web object, and your files need to be available from the website on the clients machine, not just on the backend

        Comment

        • ZiadElmalki
          New Member
          • Sep 2010
          • 43

          #5
          This is not going to work. I assume media player is the windows media player activex control running on the server.

          The client needs to watch the video on the browser. I guess using windows media player is what you want to do. You can use an object tag with the windows media player class id. You must specify the filename and this must be something that is being served from a web server the client can access. More info on the w3c schools page.

          <object
          classid="clsid: 22D6F312-B0F6-11D0-94AB-0080C74C7E95">
          <param name="FileName" value="http://mywebsite/mymove.avi" />
          </object>

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Media player is only available in Windows; however, people using the website may not be using the Windows Operating system.

            I would load the file into an iframe and let the browser determine how to display it.

            -Frinny

            Comment

            • ZiadElmalki
              New Member
              • Sep 2010
              • 43

              #7
              The browser cannot just determine how to play it. In HTL5 there is the new video element. Otherwise you need to use something to play the video in a browser.

              Comment

              • Frinavale
                Recognized Expert Expert
                • Oct 2006
                • 9749

                #8
                Please note that at this time HTML5 is not support by all major browsers.

                I still think that, right now, it's a good idea to use the iframe technique.

                -Frinny

                Comment

                • ZiadElmalki
                  New Member
                  • Sep 2010
                  • 43

                  #9
                  Can you provide an example of playing a video with just an iframe? As far as I know you need some kind of pluggin to play the video in a browser. Flash, windows media player activex control, silverlight, etc. An Iframe is just used to nest another documents with different uris in a single window.

                  If working in other OS besides windows is important than probably a silverlight or flash video player would be what you need.

                  Like I said the new video tag in HTML5 is going to eliminate the need for an external plugin to play video. But until then we need to use some kind of plugin for video.

                  Comment

                  • Frinavale
                    Recognized Expert Expert
                    • Oct 2006
                    • 9749

                    #10
                    Silverlight might be a good idea...except that I can't get it to work on my iPod Touch.

                    It's really easy, have the iframe's src point to the video that you want to play. The web browser will use the appropriate plugin to open and display the video. If there is no plugin, then it will let the users save the file and decide how to open it using applications installed on the computer (well, I'm not sure how mobile browsers will handle this...)

                    -Frinny

                    Comment

                    • ZiadElmalki
                      New Member
                      • Sep 2010
                      • 43

                      #11
                      Again can you point me to an example.

                      The only thing I can find is this they use object element inside an iframe.



                      I am pretty sure it will just open the file. It will not play in the browser.

                      I made a little test and tried in firefox and IE and it doesnt work.

                      <html>
                      <body>
                      <IFRAME src="http://nunzioweb.com/misc/wacky/Dogsmoke.mpg" width="280" height="256" scrolling="no"
                      frameborder="0" ></IFRAME>
                      </body>
                      </html>

                      Comment

                      • Frinavale
                        Recognized Expert Expert
                        • Oct 2006
                        • 9749

                        #12
                        Do you have a plugin for the browser that will play .mpg files?

                        Comment

                        • ZiadElmalki
                          New Member
                          • Sep 2010
                          • 43

                          #13
                          I a on a Windows machine so obviously yes. Sorry Frinavale it seems like I offended you. I was not trying to be rude.

                          Can you please provide a working example though or a link to some documentation or blog confirming this. Object tags are used to plugins as far as I know. If there is another way I would love to learn. Please provide the information.

                          Comment

                          Working...