0

I have a site that loads in a XML file which tells where to find the assets to load into the main SWF. Images, and external SWFs load in correctly, but for some reason FLVs don't load at all unless the contentPath is an absolute path, which I can't have for this project. I've made my links relative to the HTML page as well.

My file structure is as such:

index.html -- The main loader file

project/shared/published/section1/loader.swf -- The main SWF to load

project/english/images/videos/welcome.flv -- The movie to load in.

Is it possible that the FLVPlayback contentPath's path is relative to the SWF and NOT the HTML page? Any help would be greatly appreciated.

Code for the page loading the video

import mx.video.*;

import mx.video.*;
playback1.contentPath = getNodeValue(findNode(videos, "one"));

// Assign the mySeekBar instance to the flvPlayback instance
playback1.playPauseButton = playpause;
playback1.backButton = myrewind;
playback1.seekBar = seekbar_container.myseek;
playback1.bufferingBar = mybuffer;
lislis
  • 294
  • 5
  • 23

2 Answers2

1

Hopefully this will help you. I created a test and this is what I have:

Folder setup:

flash/application/ - loader.swf and index.html

flash/movies/ - movie.flv

The path I used was - ../movies/movie.flv

The code example is:

/**
  Requires:
   - FLVPlayback component on the Stage with an instance name of my_FLVPlybk
*/
import mx.video.*;
my_FLVPlybk.contentPath = "../movies/movie.flv";
var listenerObject:Object = new Object();
listenerObject.metadataReceived = function(eventObject:Object):Void {
    my_FLVPlybk.setSize(my_FLVPlybk.preferredWidth, my_FLVPlybk.preferredHeight);
}
my_FLVPlybk.addEventListener("metadataReceived", listenerObject);

I uploaded this to my localhost and it works fine.

I have also tested it by moving the index outside the application folder to the flash folder and this shows that the FLV is indeed relative to the swf not the html.

Neil
  • 7,861
  • 4
  • 53
  • 74
  • Neil, thanks for testing that out. I'm doing a relative path, such as ../../english/images/video/welcome.flv, but it's still not playing. On the site, the progress bar component is just loading. Is there something in my code I need to fix? Thanks – lislis May 14 '12 at 14:24
  • Do you have a link so I could have a look at it? Or is it small enough to package and email? – Neil May 14 '12 at 14:28
  • Neil, I really wish I could send you the link or e-mail because this is driving me crazy. The clients have us on a Non-disclosure agreement. – lislis May 14 '12 at 14:45
  • I've edited the question and put my code up there, I hope that can maybe give a clearer picture. Also, is there a reason that you had a metadata listener for the FLV? Is it necessary? – lislis May 14 '12 at 14:48
  • Hmm, I can't really help looking at your code, I would really need to debug it properly, try using either Firefox - firebug plugin or some http debugger like Charles or Fiddler (free versions) to see why the flv is not loading. You don't need the metadataReceived event it was in the example where I grabbed the source. – Neil May 14 '12 at 14:54
  • 1
    Neil, thanks for the advice. I took a look for the requests through Chrome's developer tools for network request, and it seems that everything was going off a preset basepath for the FLV's. I was able to narrow down the relative path to ../../videos/welcome.flv. – lislis May 14 '12 at 15:13
0

The path to the FLV files is relative to .swf file.

The path to other files is relative to .html file.

Not only in components but in general.

strah
  • 6,702
  • 4
  • 33
  • 45