Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Graphics, Flash and Multimedia _ playing local video clips

Posted by: asa rand Dec 6 2006, 02:50 PM

I have an <OBJECT> tag setup to play a video clip that is local on my hard drive. When I try to play it nothing happens. Based on what happens when I try to pass it to Windows Media Player (which says it cannot play the file), I figured out what the problem is. Now I need to find out how to fix it.

The problem is that the filepath is being resolved as "C:/My%20Documents/...", and Windows Media Player can't find the file. How do I get the player to resolve the filepath as "C:/My Documents/..." so the file can be found?

In the code for the object, I have the src attr set as src="Video/filename.wmv". I tried using src="/Video/filename.wmv", but the player wouldn't even display in the window. I also tried using a complete filepath, beginning with "file:///C:/My Documents/..." but that didn't work either.

Posted by: jimlongo Dec 6 2006, 03:04 PM

Did you try

CODE
src="C:/My%20Documents/Video/filename.wmv"

or maybe this . . . (I don't know Windows)
CODE
src="file:///C:/My%20Documents/Video/filename.wmv"


You need the %20 for the space in My Documents

Posted by: asa rand Dec 6 2006, 06:54 PM

QUOTE(jimlongo @ Dec 6 2006, 12:04 PM) *

Did you try
CODE
src="C:/My%20Documents/Video/filename.wmv"

or maybe this . . . (I don't know Windows)
CODE
src="file:///C:/My%20Documents/Video/filename.wmv"


You need the %20 for the space in My Documents


The browser gets the path and replaces all spaces with %20. Windows Media Player doesn't seem to be able to convert the %20s back to spaces. I need to know how to get the %20s converted back to spaces when the player receives the filepath string.

Posted by: jimlongo Dec 6 2006, 07:04 PM

I'll admit to not knowing squat about Windows Media Player, but it's the browser that retrieves the file and hands it to the plug-in. What does the player have to do with spaces in the URL. It should be able to play the file the browser hands it.

Posted by: Peter1968 Dec 6 2006, 07:16 PM

QUOTE(asa rand @ Dec 7 2006, 10:54 AM) *

The browser gets the path and replaces all spaces with %20. Windows Media Player doesn't seem to be able to convert the %20s back to spaces. I need to know how to get the %20s converted back to spaces when the player receives the filepath string.


Move to the files to a directory that has no spaces in it - there's nothing stopping you from doing that.

Posted by: asa rand Dec 6 2006, 07:53 PM

QUOTE(Peter1968 @ Dec 6 2006, 04:16 PM) *

QUOTE(asa rand @ Dec 7 2006, 10:54 AM) *

The browser gets the path and replaces all spaces with %20. Windows Media Player doesn't seem to be able to convert the %20s back to spaces. I need to know how to get the %20s converted back to spaces when the player receives the filepath string.


Move to the files to a directory that has no spaces in it - there's nothing stopping you from doing that.


Well, I can't rename 'My Documents' to MyDocuments or My_Documents, and it's not just the local directory that's the problem. In fact, the directory the vid clips are in is named 'Video'.

Anyway, I found out that the problem is Firefox. If I load the page into Internet Explorer the vid clip plays just fine in the window and the link to pass it to WMP externally works too. It just doesn't work in Firefox.

Posted by: asa rand Dec 6 2006, 08:01 PM

QUOTE(jimlongo @ Dec 6 2006, 04:04 PM) *

I'll admit to not knowing squat about Windows Media Player, but it's the browser that retrieves the file and hands it to the plug-in. What does the player have to do with spaces in the URL. It should be able to play the file the browser hands it.


Well, it seems as though WMP is being passed a filepath string, and WMP says it can't find the file. Checking the error details it shows the filepath spec being passed is 'C:/My%20Documents/...' ... since WMP doesn't find a folder named My%20Documents, the load fails with a file not found or bad pathname error.

As I stated in my other reply, I found that the problem is in the way Firefox passes the filepath. The same page in Internet Explorer works without a problem.

Posted by: pandy Dec 6 2006, 09:04 PM

There's nothing wrong with the %20. You have the HTML on your local drive too, don't you? Because if you try to do this from a server, IE may let you but I doubt any other browser will.

Posted by: asa rand Dec 6 2006, 09:25 PM

QUOTE(pandy @ Dec 6 2006, 06:04 PM) *

There's nothing wrong with the %20. You have the HTML on your local drive too, don't you? Because if you try to do this from a server, IE may let you but I doubt any other browser will.


All I know is that Windows Media Player says it can't find the file when it's passed from Firefox and has no problem when it's passed from Internet Explorer. And the only difference is the file path. When Firefox passes it it comes out:

"C:/Documents%20and%20Settings/User/My%20Documents/..."

and when Internet Explorer passes it it comes out:

"C:/Documents and Settings/User/My Documents/..."

I know that browser wise %20 and a space character are the same thing, but Windows Media Player doesn't see it that way, and apparently neither does the plugin.

Posted by: pandy Dec 6 2006, 10:51 PM

But surely you must know if you have the HTML page on a server of if it is on your own hard drive? smile.gif

Posted by: asa rand Dec 6 2006, 10:59 PM

QUOTE(pandy @ Dec 6 2006, 07:51 PM) *

But surely you must know if you have the HTML page on a server of if it is on your own hard drive? smile.gif


Oops. I'm sorry. Perhaps I never made it clear. I am trying to view the vid clip from my hard drive, not a server somewhere else on the net.

As a result, the browser has to resolve the local filepath and not a url. When Firefox does this, it converts all space characters in the filepath to %20s. When it passes the string to the plugin (or to the external player) it doesn't convert the %20s back to spaces.

While %20 is the browsers way of dealing with spaces so the HTTP engines don't cough, the strings "My Documents" and "My%20Documents" are not the same. The plugin and the external player both look for the exact string, and do not parse the %20s as spaces.

Posted by: Peter1968 Dec 7 2006, 03:14 AM

Once again, if the spaces are giving you so much trouble why *must* your songs be in the My Documents directory? Why not move them to a single word directory? What is stopping you from doing that?

Sorry, I'm having dramas understanding why you don't keep things simple and do that.

Posted by: asa rand Dec 7 2006, 01:54 PM

QUOTE(Peter1968 @ Dec 7 2006, 12:14 AM) *

Once again, if the spaces are giving you so much trouble why *must* your songs be in the My Documents directory? Why not move them to a single word directory? What is stopping you from doing that?

Sorry, I'm having dramas understanding why you don't keep things simple and do that.


1. Simple is fine, but doesn't solve the problem.

As to why I want to keep things where they are?
2. Because I want to.
3. That's what My Documents is for.
4. I can organize all of my files in one place.
5. I don't have to clutter my desktop with folder icons.

The most important thing, for me, is that I like to fix what's broken, not find a "simple solution" that avoids finding the cause. In this case the cause is Firefox. It has some bad code that has to be rewritten.

Posted by: pandy Dec 7 2006, 02:53 PM

I think you make assumptions that aren't necessarily right.

Could you, as an experiment, copy the HTML to the directory where the video file is and edit the path so it's just the file name? Then see if it works in FF.

Posted by: asa rand Dec 7 2006, 03:23 PM

QUOTE(pandy @ Dec 7 2006, 11:53 AM) *

I think you make assumptions that aren't necessarily right.

Could you, as an experiment, copy the HTML to the directory where the video file is and edit the path so it's just the file name? Then see if it works in FF.


Actually, I already did that. Firefox still has to complete the entire path and pass it to the plugin/external app, and the spaces in "Documents and Settings" and in "My Documents" were replaced with %20s.

I will recreate it, take screenshots and post both code and screenshots here. Maybe you can then see something I may be missing.

Posted by: Christian J Dec 7 2006, 03:35 PM

QUOTE(asa rand @ Dec 7 2006, 03:25 AM) *

All I know is that Windows Media Player says it can't find the file when it's passed from Firefox and has no problem when it's passed from Internet Explorer. And the only difference is the file path. When Firefox passes it it comes out:

"C:/Documents%20and%20Settings/User/My%20Documents/..."

Just in case: is the above correct? IIRC Firefox converts paths to "file:///" something, similar (but maybe not identical) to Opera.

Just noticed that IE has been doing the same thing all along. blink.gif

Posted by: jimlongo Dec 7 2006, 03:35 PM

If you're so sure it's a Firefox problem, then I'd suggest you're not going to get any help here.

http://kb.mozillazine.org/Windows_Media_Player

Posted by: asa rand Dec 7 2006, 03:47 PM

OK. Here are the results. I copied the page into the same folder and edited the src="filename" attributes to reflect current directory, as follows:

CODE

<!-- begin embedded WindowsMedia file... -->
<OBJECT id='mediaPlayer' width="320" height="285"
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
<PARAM name='fileName' value="001_belias_sm.wmv">
<PARAM name='animationatStart' value='true'>
<PARAM name='transparentatStart' value='true'>
<PARAM name='autoStart' value="true">
<PARAM name='showControls' value="true">
<PARAM name='loop' value="false">
<EMBED type='application/x-mplayer2'
  pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
  id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1'
  bgcolor='darkblue' showcontrols="true" showtracker='-1'
  showdisplay='0' showstatusbar='-1' videoborder3d='-1' width="320" height="285"
  src="001_belias_sm.wmv" autostart="true" designtimesp='5311' loop="false">
</EMBED>
</OBJECT>
<!-- ...end embedded WindowsMedia file -->
<!-- begin link to launch external media player... -->
<A href="001_belias.wmv" style='font-size: 85%;' target='_blank'>Launch in external player</A>
<!-- ...end link to launch external media player... -->


Here is the properties as shown when the player on the page is right-clicked and properties selected:

IPB Image

Here is the error message the external player displays when the filespec is passed to it:

IPB Image

Here is the properties WMP shows for the filespec passed:

IPB Image

Posted by: asa rand Dec 7 2006, 03:50 PM

QUOTE(jimlongo @ Dec 7 2006, 12:35 PM) *

If you're so sure it's a Firefox problem, then I'd suggest you're not going to get any help here.

http://kb.mozillazine.org/Windows_Media_Player


I'm already working on getting help from Firefox. When I posted here it was because I thought maybe I had an error in my code. Then I found that IE7 didn't have any trouble with the page or the file.

Posted by: jimlongo Dec 7 2006, 04:22 PM

Also you may be faced with the daunting task that Firefox will tell you that it's the plug-in that is causing the problem.
So you would then be looking at Microsoft support. But since it works in IE I doubt you'd have much success suggesting to them that there is any problem at all.






Posted by: Christian J Dec 7 2006, 04:54 PM

I got the same problem with Firefox. But when clicking the link that opens an external Windows Media Player it could display the file name in the WMP window (after I closed the error message), which suggests the path is correct...? unsure.gif

Posted by: asa rand Dec 7 2006, 05:52 PM

If you right-click the filename in WMP and select error details, it will tell you it can't find the file. If you right-click the filename and select Properties, you'll see that the file path is full of %20s where spaces should be.

Do the same thing using IE and the file will load and play. Right-clicking the filename then and selecting Properties, you'll see that the file path is correct, with spaces instead of %20s.

Posted by: asa rand Dec 7 2006, 05:56 PM

QUOTE(jimlongo @ Dec 7 2006, 01:22 PM) *

Also you may be faced with the daunting task that Firefox will tell you that it's the plug-in that is causing the problem.
So you would then be looking at Microsoft support. But since it works in IE I doubt you'd have much success suggesting to them that there is any problem at all.


Someone on the Firefox forum is already suggesting that something else must be wrong, so I don't doubt you're correct. I can only hope that I can prove to them that the problem is Firefox, not the plugin. Plus, since it happens with the external app as well, then I would think that would rule out the plugin being the culprit.

Posted by: jimlongo Dec 7 2006, 06:20 PM

Yeah the problem is with the player. sad.gif

Posted by: Christian J Dec 7 2006, 06:28 PM

Now I tested with an .mp3 file and an .mpg video, and both worked when you clicked the link in Firefox to the external WMP. None started in the embedded player. A .wma file did not work at all.

When I closed FF I got something like this error alert: "A plugin has performed an invalid operation. You should restart Firefox"

Posted by: asa rand Dec 7 2006, 08:04 PM

QUOTE(Christian J @ Dec 7 2006, 03:28 PM) *

Now I tested with an .mp3 file and an .mpg video, and both worked when you clicked the link in Firefox to the external WMP. None started in the embedded player. A .wma file did not work at all.

When I closed FF I got something like this error alert: "A plugin has performed an invalid operation. You should restart Firefox"


That is interesting. Perhaps I should put the link to this thread in a post on Firefox so they can read it and see what has been the result of many people trying.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)