开发者

fl.video.VideoPlayer loads flv relative to swf?

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开发者_如何学JAVA-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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜