subtafuge.com

19Apr/0824

Flash/SWF/FLV embedding problem (Controls and Skin)




Are you having a problem with embedding of flash files on your site, where the controls/skin isn't showing, but they do show if you access the SWF directly?

I am not a big fan of Flash. And I have never used it on any of my websites. Unfortunately though, I have been redesigning a website for a friend which has forced me into this realm of Flash Frustration™.  There are about 400 flash videos on this site, so it is impossible to convert them to an alternate format.

Basically the site was completely static, and maintenance was time consuming. So I am changing it to be dynamic (database driven ASP). Each SWF file has a skin, which allows controls like Play and Stop etc.  The problem is when you are using an ASP page to load content from a database, that asp file exists once, to load all content (of the specific type). Therefore you cut out having to have 1 htm file for each SWF file. Sounds great. However, in all of Adobe's brilliance they decided that you have to have the SWF(skin and controls/loader), FLV (actual video) and HTM (with the EMBED code) in the same folder. This is just dumb. Anyway, one solution would have been to copy all the SWF and FLV files to one folder (the folder where the ASP file was). This would be a nightmare!

I had to find a workaround. I have been google'ing for the past 3 hours on this issue. Unfortunately, all that did was confirm the fact that the files all need to be in the same place.  I needed to somehow make the swf/flv files think that they were being called from the same folder. I looked up methods of URL rewriting. That didn't help much.

Solution

I then pulled back from the problem and though of something. iFrames! Yep, that simple. It works flawlessly. You don't have to have a dynamic page (ASP or PHP), you could just  use a plain old HTML file.

So, lets say you have a SWF file: \media\movies_action\themovie.swf
You have an HTML page in folder:  \main\

If you try the traditional <embed>/<object> method, the file will probably play, but you won't have any controls or skin.

So instead...inside the html file, just put this code :

<iframe src="\media\movies_action\themovie.swf" frameborder="0" width="400px" height="300px"> </iframe>

This will create a 400x300 pixel iframe which has the flash file playing, with all the controls in place! Easy. Let me know if this helped you out.



Comments (24) Trackbacks (0)
  1. been stuck trying to find a solution to this for ages. such a simple solution….thank you!

  2. Fucking AWESOME! Great solution!!!

  3. Thank you for this! Totally worked for me, been looking for hours too and nothing worked until this!

  4. Does anyone know if there is code i can include with this to stop it from autoplaying? I want the user to have to press play to start the video. Any help would be great, thanks!

  5. Hi Michelle, I think that is inherent to the way the SWF file was originally made. If you created the file yourself, then you can try modify it at the source.

  6. i tried to copy and paste your code in html (ofcourse corrected the file name) but i might be missing something.. it gives me error. where exactly in Dreamweaver CS3 shud i insert?

  7. The controls aren’t showing up for me. Is it dependent some settings in the server?

  8. Hi Jon,

    It shouldn’t be server dependant. When you load the SWF file on your pc from your local drive, can you see the controls?

  9. Fantastic Solution – Thank you, Thank you!!

  10. hi,

    I am also not getting controls…..
    Any solution???

  11. for some reason it won’t work on Firefox. Works fine on IE.

  12. Not getting the controls either! :(

  13. Thanks! This worked great! had to swap out the “quotes” to make it work (hint, hint… everyone else)

  14. good one, works flawlessly!

  15. Thank you, i spent around 5 hours or experimenting/frustration.

    Great:-)

  16. One more thing, it works locally but not online, i have uploaded all my files and nothing, kind of back to square 1? any REAL solutions?

    thanks

  17. Thanks, this finally solved it…

  18. Great!!!! Pheeeewwwwww! Thanks

  19. Great solution dude – you made my day!

  20. please tell me where to put those code in my html…. please

  21. this is awesome! i just wasted 2 days trying to fix this problem. you are a genius!

  22. Can see the fist frame but the movie is not playing or showing controls…
    Tried IE and Firefox.
    BACK TO GOOGLE!

  23. Thank you so much for this solution! Have spent hours looking for this!
    Much appreciated!

  24. Thank you!, Thank you!, Thank you!, Thank you!, and Thank you!
    That’s what I call thinking outside of the box.. Or frame :)


Leave a comment

No trackbacks yet.