views:

401

answers:

1

Update: Turns out this is undocumented behaviour of the NetStream class - NetStream loads relative to the swf, as opposed to URLRequest which loads relative to the HTML doc... annoying.


I am having a strange issue where loading an FLV file using the fl.video.VideoPlayer class that comes with CS4: Adobe docs here

Usually when loading external content into flashplayer, the path is relative to the HTML page that the swf is embedded in - but when I try and load an FLV using the VideoPlayer class the player looks for a path relative to the swf, not to the HTML (as you would expect).

eg: My file setup is:
index.html (which contains the swf)
swf/my-video-player.swf
video/my-video.flv

When I call videoPlayer.play("video/my-video.flv"), from the swf (in index.html), the browser attempts to load "swf/video/my-video.flv", which is relative to the swf, not to the HTML.

Has anyone else experienced this behaviour with the VideoPlayer class? Any ideas why this might be happening?

+1  A: 

Flash "always" uses the html's path as the base for relative paths (more specificaly, all URLRequests)... This is unless the base html parameter is set (see here).

However, I remember that when FileReference came out in AS2 (dunno about NetStream), for some reason its paths were always relative to the swf... when AS3 came out I think URLRequest fixed it.

I don't know which "VideoPlayer" class you refer to... a quick google search gives me a link to an AS2 class, so if you are using AS2 (bad tags BTW ^^) you might be running into the problem I mention.

And now that I think about it, NetStream doesn't use URLRequests (is it the only external loading process that doesnt?), so it might be related to that... maybe URLRequest.url gives a corrected url, I haven't tried it.

Cay
I'm using as3 - I've updated my question to include a link to the class docs.
Reuben
As far as i can tell, fl.video.VideoPlayer uses a NetStream as its connection, so this might be the issue - I'll look in to it.
Reuben
Thanks Cay, it seems NetStream was the issue - see update
Reuben