11 Replies Latest reply on Sep 29, 2011 9:12 AM by linithos

    Spark Video Player path problem

    RudiAcikgoz Level 1



      I am trying to play a flv video in my flex application.I tried to put the video file in local packages (asset, video subpages..etc), but i did not work at all.

      When I put the video into root folder, which is called "src" by default and also in my application as well, it plays the video properly in my development environment (Flash Builder 4). But at that time, It didn't work properly after exporting the application as a release build output.


      I stuck with the problem, any help will be appricated.


        • 1. Re: Spark Video Player path problem
          abavisg Level 1



          first of all all the assets that are not embedded in your app should actually be in your debug or release folder, named bin-debug and bin-release by default. But that can be changed anyway.

          Now I assume that it currently finds the video as it is copied from the src folder into the bin-debug folder (there is this option "copy non-embedded files to output folder" enabled by default in the compiler options). You can actually uncheck this as it's confusing.If you do uncheck ityou have to remember that all the assets that are loaded on runtime, like this video, should be placed in the bin-debug folder when you debug and inside the bin-release folder when you release it. All the files then should be copied on the web server for final release.

          Be aware though that the src folder is just a folder where you actually put your packages, libraries maybe, other embedded assets. You shouldn't put here any other assets like videos, mp3's or images that are loaded on runtime. These are not compiled at the end and they should be placed manually on the server.

          Finally remember that the app is not running from src (again that's where you develop your code) but from bin-debug and when you do a release you must take the exported swf from bin-release. So in your case now the app when't it's debugging (and running from bin-debug if you haven't changed it) is looking for the video in the bin-debug folder structure.


          Let me know if that helps you!





          • 2. Re: Spark Video Player path problem
            RudiAcikgoz Level 1

            thank you for quick suggestion,

            I am in progress of developing a standalone flex application, which is a demo-like one, without using any web server container. I achieved to display images by embeding them, and the other things works fine without any question. I need to play a video in the application again without using any server container.


            So, I tried your suggest and no luck I still have the same problem

            • 3. Re: Spark Video Player path problem
              abavisg Level 1

              I am guessing you mean that you will run the swf directly on the Flash Player?

              Then the video should be sitting next to the swf or in the same floder structure you declared in the osurce of the Video component.

              so if you are using the VideoDisplay then you must have set the source property to something like source="video.flv". This means that the video should be sitting next to the swf.

              Where is the video at the moment in relation to the swf you are running and how do you run the swf?




              • 4. Re: Spark Video Player path problem
                longo69115 Level 1

                if your videosource in the flex project is source="video.flv", your video has to be in the same folder than you exported swf (like abavisg just said). if you put it in a folder like "assets", this folder has to be placed on your server next to your swf

                • 5. Re: Spark Video Player path problem
                  RudiAcikgoz Level 1

                  Hi abavisg,

                  I need to play a FLV video directly in Flash Player.

                  I tried to put the video media file into debug-bin directory, it runs properly once the application is ran by using Flash Builder. But the problem is that when I export the application and run it via web browser it could not locate the video file. Please find the code and the exported application's folder structure below.


                  <s:VideoPlayer source="video.flv"/>


                  • 6. Re: Spark Video Player path problem
                    abavisg Level 1

                    ok if you are viewing the swf from a browser then make sure that you are viewing from an http request not a file request.

                    That means the url is starting with http:// and not file:///

                    From what i understand so far you are trying to view the swf on the browser but not from web server. Just by double clicking the swf or the html wrapper! Correct?


                    Anyway, in order to view it correctly you need to need to setup a local server environment.

                    On mac you can use MAMP, on windows XAMP (I think - not a windows user myself ).


                    Viewing a swf on the browser but not via HTTP throws a security error, and therefore not allowing you to load a video, image etc

                    An example is here.


                    SecurityError: Error #2148: SWF file file:///removedmydetails/TestPreloaderNew/bin-release/Preloader.swf cannot access local resource file:///removedmydetails/TestPreloaderNew/bin-release/videos/video.flv. Only local-with-filesystem and trusted local SWF files may access local resources.


                    So it can find the video but can't load it. But you are unable to see the error.


                    If you have an online space then you can try uploading the files there and test them.


                    Let me know if that helps



                    • 7. Re: Spark Video Player path problem
                      RudiAcikgoz Level 1

                      correct. I am trying to open it by only double clicking via HTML directly.

                      I tried also deploying the application and resources to a web server andI got the same error. There is only one way to make it runs properly that running the application via Flash Builder 4.


                      Then I tried your references about trusted local file. It helped the application running fine on the server and in the local as well. But it makes my demo application very hard to deploy on any other computer, which the resources should be marked as trusted ones manually.


                      thank you for your help... But  I am still stıuck with the same problem and I do not want anyone to do the same once trying to run the application.


                      Is there any way to avoid registering a resource as trusted one ?..

                      • 8. Re: Spark Video Player path problem
                        abavisg Level 1

                        First of all do you the files on a server where i can test it as well?

                        You can post a link and I can debug it.


                        Now if you are planning to run the swf locally all the time with the video siiting next to it, then you need to put this into the compiler argument




                        this will allow the swf to load the video when tested on the stand alone Flash player, not only on the web browser.

                        However this won't allow you to run the swf locally and "pull" the video from a remote server.

                        e.g I have a swf that runs locally not on a browser, setup as above, and the video is hosted in my web server.

                        Here in thsi case Flash Player stops me from playing the video for security reasons.


                        So you have to options assuming that I understood correctly and you are planning to deploy the swf as standalone (by that I mean you are going to give to the customers the swf and they can run it locally by doubleclicking it on their computers):



                        if you are giving them the video as well (all packaged in teh same folder) then you should go with -use-network=false

                        e.g the swf plays locally and video is located next to the swf, same folder structure you defined in your app, both in the clients computer.



                        if you don't want to give the video to the clients but only the swf and then host the video on a remote server online, then you should be ok

                        e.g the swf plays locally and the video is "pulled" form a remote server like "http://www.domainname.com/videos/video.flv" (don't forget to put in the source of the VideoDisplay the absolute path.


                        I hope that helps



                        • 9. Re: Spark Video Player path problem
                          Mohit M Chavda Level 1



                          This is great that pick video from root but it's only when we use  -use-network=false , but after use this our HTTPService call or any other call is not work.
                          Is any one have new idea how can we call .flv from root and also make call or HTTPService ?

                          • 10. Re: Spark Video Player path problem
                            RudiAcikgoz Level 1


                            By the way, my application scope has an external web service call, which prevents me to use -use-network=false. I tried to deploy my application to a web server without changing video's local path. (I mean src="video.flv" remained). It works properly in web server container. So, the problem got resoloved and I told URL address of application as weel to run it at customer side.


                            That, exporting the application as a standalone one, still causes the problem of viewing the video



                            • 11. Re: Spark Video Player path problem
                              linithos Level 1

                              Hello Rudi,


                              I have the same problem here, I need to distribuite the application on a CD and load the .swf from there. Could you find any solution for this problem?


                              Thanks in advance