Embedded WMP

Discussion in 'ASP .Net Web Controls' started by Greg S, Apr 23, 2007.

  1. Greg S

    Greg S Guest

    I have a Window Media Player control embedded in my page... and a Listbox
    that has a list of files on a certain network share (all video files). When
    the user selects from the listbox and clicks a button, I want the WMP control
    to play that video.
    I am passing the correct path to the player's URL property, but I can't get
    the video to play. The control goes to "Ready" for a split second, but then
    it looks like the page refreshes and then, nothing. Here is my Javascript to
    pass the correct path to the player:

    <script type="text/javascript">
    function setPlayerURL() {
    player = document.getElementById("wmpWindow")
    myURL =
    document.getElementById("pathStore").getAttribute("value");
    player.URL = myURL;
    player.controls.play();
    }
    </script>
    Greg S, Apr 23, 2007
    #1
    1. Advertising

  2. My guess would be it doesn't like the URL you're giving it.
    Perhaps the filename is incorrect or it doesn't like the path you're
    supplying (if any). Try supplying the full absolute URL to the media file
    and see if that helps.

    Here's more info:
    http://SteveOrr.net/articles/StreamingMedia.aspx

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    http://SteveOrr.net



    "Greg S" <Greg > wrote in message
    news:...
    >I have a Window Media Player control embedded in my page... and a Listbox
    > that has a list of files on a certain network share (all video files).
    > When
    > the user selects from the listbox and clicks a button, I want the WMP
    > control
    > to play that video.
    > I am passing the correct path to the player's URL property, but I can't
    > get
    > the video to play. The control goes to "Ready" for a split second, but
    > then
    > it looks like the page refreshes and then, nothing. Here is my Javascript
    > to
    > pass the correct path to the player:
    >
    > <script type="text/javascript">
    > function setPlayerURL() {
    > player = document.getElementById("wmpWindow")
    > myURL =
    > document.getElementById("pathStore").getAttribute("value");
    > player.URL = myURL;
    > player.controls.play();
    > }
    > </script>
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Apr 24, 2007
    #2
    1. Advertising

  3. Greg S

    Greg S Guest

    The URL i am supplying is legit. I am storing it in a textbox for the time
    being so I can see what it is. I copy and paste that into the Windows run
    line, full-blown WMP opens and plays, no problem. I also put it in quotes,
    and get the same result.

    If I comment out the line:
    player.URL = myURL;
    nothing happens to the embedded player. With that line in there, the player
    displays "Ready" for a second before the page refreshes and loses the ability
    to play.

    "Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:

    > My guess would be it doesn't like the URL you're giving it.
    > Perhaps the filename is incorrect or it doesn't like the path you're
    > supplying (if any). Try supplying the full absolute URL to the media file
    > and see if that helps.
    >
    > Here's more info:
    > http://SteveOrr.net/articles/StreamingMedia.aspx
    >
    > --
    > I hope this helps,
    > Steve C. Orr,
    > MCSD, MVP, CSM, ASPInsider
    > http://SteveOrr.net
    >
    >
    >
    > "Greg S" <Greg > wrote in message
    > news:...
    > >I have a Window Media Player control embedded in my page... and a Listbox
    > > that has a list of files on a certain network share (all video files).
    > > When
    > > the user selects from the listbox and clicks a button, I want the WMP
    > > control
    > > to play that video.
    > > I am passing the correct path to the player's URL property, but I can't
    > > get
    > > the video to play. The control goes to "Ready" for a split second, but
    > > then
    > > it looks like the page refreshes and then, nothing. Here is my Javascript
    > > to
    > > pass the correct path to the player:
    > >
    > > <script type="text/javascript">
    > > function setPlayerURL() {
    > > player = document.getElementById("wmpWindow")
    > > myURL =
    > > document.getElementById("pathStore").getAttribute("value");
    > > player.URL = myURL;
    > > player.controls.play();
    > > }
    > > </script>

    >
    Greg S, Apr 26, 2007
    #3
  4. My next guess would be a security issue.
    You say it runs fine within windows, but ASP.NET runs under a different
    security context.
    Where is the media file located? Is it within the web application's folder?
    What is the URL you're using?

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    http://SteveOrr.net


    "Greg S" <> wrote in message
    news:...
    > The URL i am supplying is legit. I am storing it in a textbox for the time
    > being so I can see what it is. I copy and paste that into the Windows run
    > line, full-blown WMP opens and plays, no problem. I also put it in quotes,
    > and get the same result.
    >
    > If I comment out the line:
    > player.URL = myURL;
    > nothing happens to the embedded player. With that line in there, the
    > player
    > displays "Ready" for a second before the page refreshes and loses the
    > ability
    > to play.
    >
    > "Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:
    >
    >> My guess would be it doesn't like the URL you're giving it.
    >> Perhaps the filename is incorrect or it doesn't like the path you're
    >> supplying (if any). Try supplying the full absolute URL to the media
    >> file
    >> and see if that helps.
    >>
    >> Here's more info:
    >> http://SteveOrr.net/articles/StreamingMedia.aspx
    >>
    >> --
    >> I hope this helps,
    >> Steve C. Orr,
    >> MCSD, MVP, CSM, ASPInsider
    >> http://SteveOrr.net
    >>
    >>
    >>
    >> "Greg S" <Greg > wrote in message
    >> news:...
    >> >I have a Window Media Player control embedded in my page... and a
    >> >Listbox
    >> > that has a list of files on a certain network share (all video files).
    >> > When
    >> > the user selects from the listbox and clicks a button, I want the WMP
    >> > control
    >> > to play that video.
    >> > I am passing the correct path to the player's URL property, but I can't
    >> > get
    >> > the video to play. The control goes to "Ready" for a split second, but
    >> > then
    >> > it looks like the page refreshes and then, nothing. Here is my
    >> > Javascript
    >> > to
    >> > pass the correct path to the player:
    >> >
    >> > <script type="text/javascript">
    >> > function setPlayerURL() {
    >> > player = document.getElementById("wmpWindow")
    >> > myURL =
    >> > document.getElementById("pathStore").getAttribute("value");
    >> > player.URL = myURL;
    >> > player.controls.play();
    >> > }
    >> > </script>

    >>
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Apr 26, 2007
    #4
  5. Greg S

    Greg S Guest

    No, it is not in the application's root folder- there are about 1000 video
    files so they live on a Windows Storage Server. So it is a fully qualified
    path. An example of one of the files:

    "\\wss\Video Presentations\2007\Profiles\video.avi"

    This is the exact string getting passed to the player... is it not possible
    to play media that are not in the app's root folder?

    I don't think it is a security issue- at first page load, the app scans the
    entire share and populates a listbox with all media files in the directory
    and its subfolders. If it was a security issue, it wouldn't be able to do
    that. I took some code to impersonate a user- i am impersonating myself, and
    I am a domain admin.

    "Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:

    > My next guess would be a security issue.
    > You say it runs fine within windows, but ASP.NET runs under a different
    > security context.
    > Where is the media file located? Is it within the web application's folder?
    > What is the URL you're using?
    >
    > --
    > I hope this helps,
    > Steve C. Orr,
    > MCSD, MVP, CSM, ASPInsider
    > http://SteveOrr.net
    >
    >
    > "Greg S" <> wrote in message
    > news:...
    > > The URL i am supplying is legit. I am storing it in a textbox for the time
    > > being so I can see what it is. I copy and paste that into the Windows run
    > > line, full-blown WMP opens and plays, no problem. I also put it in quotes,
    > > and get the same result.
    > >
    > > If I comment out the line:
    > > player.URL = myURL;
    > > nothing happens to the embedded player. With that line in there, the
    > > player
    > > displays "Ready" for a second before the page refreshes and loses the
    > > ability
    > > to play.
    > >
    > > "Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:
    > >
    > >> My guess would be it doesn't like the URL you're giving it.
    > >> Perhaps the filename is incorrect or it doesn't like the path you're
    > >> supplying (if any). Try supplying the full absolute URL to the media
    > >> file
    > >> and see if that helps.
    > >>
    > >> Here's more info:
    > >> http://SteveOrr.net/articles/StreamingMedia.aspx
    > >>
    > >> --
    > >> I hope this helps,
    > >> Steve C. Orr,
    > >> MCSD, MVP, CSM, ASPInsider
    > >> http://SteveOrr.net
    > >>
    > >>
    > >>
    > >> "Greg S" <Greg > wrote in message
    > >> news:...
    > >> >I have a Window Media Player control embedded in my page... and a
    > >> >Listbox
    > >> > that has a list of files on a certain network share (all video files).
    > >> > When
    > >> > the user selects from the listbox and clicks a button, I want the WMP
    > >> > control
    > >> > to play that video.
    > >> > I am passing the correct path to the player's URL property, but I can't
    > >> > get
    > >> > the video to play. The control goes to "Ready" for a split second, but
    > >> > then
    > >> > it looks like the page refreshes and then, nothing. Here is my
    > >> > Javascript
    > >> > to
    > >> > pass the correct path to the player:
    > >> >
    > >> > <script type="text/javascript">
    > >> > function setPlayerURL() {
    > >> > player = document.getElementById("wmpWindow")
    > >> > myURL =
    > >> > document.getElementById("pathStore").getAttribute("value");
    > >> > player.URL = myURL;
    > >> > player.controls.play();
    > >> > }
    > >> > </script>
    > >>

    >
    Greg S, Apr 26, 2007
    #5
  6. Greg S

    Greg S Guest

    As you were leading on, the problem is that the app wants the file to be in
    its root folder. So the URL is actually ending up as this:

    http://localhost:1464/app1/"/wss/Video Presentations/...

    Is there a way to get rid of that, and play files NOT in the root?
    Greg S, Apr 26, 2007
    #6
  7. You could create a special page (or HTTPHandler) to dish out the files.
    It would probably use the Response.WriteFile method to grab the specified
    file from the share and output it.
    This would also allow you to change the file location in the future more
    easily.
    Here's more info:
    http://msdn2.microsoft.com/en-us/library/aa332830(vs.71).aspx

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    http://SteveOrr.net


    "Greg S" <> wrote in message
    news:...
    > As you were leading on, the problem is that the app wants the file to be
    > in
    > its root folder. So the URL is actually ending up as this:
    >
    > http://localhost:1464/app1/"/wss/Video Presentations/...
    >
    > Is there a way to get rid of that, and play files NOT in the root?
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], May 2, 2007
    #7
  8. Greg S

    Greg S Guest

    Thanks for all your help. I figured it out. Simple as changing my button from
    an ASP button to a regular HTML button.
    Hey, I told you I'm new at this.
    Again, thanks for working with me on this.

    "Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:

    > You could create a special page (or HTTPHandler) to dish out the files.
    > It would probably use the Response.WriteFile method to grab the specified
    > file from the share and output it.
    > This would also allow you to change the file location in the future more
    > easily.
    > Here's more info:
    > http://msdn2.microsoft.com/en-us/library/aa332830(vs.71).aspx
    >
    > --
    > I hope this helps,
    > Steve C. Orr,
    > MCSD, MVP, CSM, ASPInsider
    > http://SteveOrr.net
    >
    >
    > "Greg S" <> wrote in message
    > news:...
    > > As you were leading on, the problem is that the app wants the file to be
    > > in
    > > its root folder. So the URL is actually ending up as this:
    > >
    > > http://localhost:1464/app1/"/wss/Video Presentations/...
    > >
    > > Is there a way to get rid of that, and play files NOT in the root?

    >
    Greg S, May 7, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gsauns

    Embedded WMP stops playing

    gsauns, Apr 27, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    398
    gsauns
    Apr 29, 2007
  2. Aris

    Embedded WMP 9

    Aris, Jun 10, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    113
  3. RomanVN

    IE, embedded WMP 9.0: double GET request

    RomanVN, Jul 3, 2006, in forum: ASP General
    Replies:
    0
    Views:
    140
    RomanVN
    Jul 3, 2006
  4. craig
    Replies:
    3
    Views:
    162
    craig
    Dec 16, 2003
  5. bobo
    Replies:
    0
    Views:
    98
Loading...

Share This Page