Embedded WMP

G

Greg S

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>
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

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
 
G

Greg S

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 said:
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 said:
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>
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

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 said:
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 said:
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 said:
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>
 
G

Greg S

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 said:
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 said:
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 said:
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



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>
 
G

Greg S

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?
 
G

Greg S

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 said:
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 said:
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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top