embedding flash video

robskee - August 26, 2006 - 09:40

First off, I've really enjoyed working with Drupal. My site still has a long ways to go, especially in the appearance department (my graphics guy is getting lazy on me), but Drupal has proven to be very flexible and I love all the built in features and modules.

I'm having a bit of a problem getting embedded flash video to display properly on the frontpage of my site as a blog post. I have everything setup correctly on the flash side of things; i even made a test html page outside of drupal to make sure that it worked correctly, you can see it here (there's one swear word on the clip, don't watch it if that offends you):

http://www.mancrabs.com/test

That page is just the snippet of html made by Flash 8, and as you can see it works perfectly fine as a plain html page loading from the server. But when I put the same html code into my blog post, this is the result:

http://www.mancrabs.com/testingflash

Also, if I publish that test blog post to the front page, all the other blog posts beneath it disappear, along with the right side-bar and the footer. Am I missing something totally obvious, or is this not supported without using one of the media modules?

I was using WMV, but the problem (besides compatibility) is that they autoload automatically, killing my bandwidth if I have more than one video on the front page. Having 3 or 4 videos load when the user only wants to watch one of them is a huge waste of bandwidth. With flash, I can set the videos up so that they dont start to load until the play button is clicked. I ended up using screenshots on the front page as links to separate pages containing the embeded videos, but I with flash I could avoid all that.

Any help would be greatly appreciated.

Two sides of embedding flash movie

mac_perlinski - August 26, 2006 - 11:36
  • Your problem seems to be very simple you are putting your flash code into the content of your page, i would like to suggest changing input format to PHP Code so its not going to be filtered in ant way. Thats the first thing and it should work.
  • The outher thing please search for the phrase flash in the modules section , there is a module which enables you to publish inline flash movies.

And here comes the final word and only my opinion, both ways above are rather not nice, lately Microsoft released their famouse update which treats embed objects in different way so if someone wants to click on the active element of your movie first has to activate element. It means you have a dashed border around your flash movie in IE.
I would suggest including in your page.tpl.php in the

<head><script src="/includes/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="/includes/AC_ActiveX.js" type="text/javascript"></script></head>
<body>
<?php
/*You embed your flash movie using the following function you can place
the following code in page.tpl.php or inside the content of your node*/
echo "<script type='text/javascript'>AC_FL_RunContent( 'codebase','http://fpdownload.macromedia.com/pub/shockwave/
cabs/flash/swflash.cab#
version=8,0,0,0','width','766','height','129','src','/images/flash_movie_without_dot_swf_ext','quality','high','pluginspage',
'http://www.macromedia.com/go/getflashplayer','movie','/images/flash_movie_without_dot_swf_ext','wmode','transparent');
</script>"
;
?>

</body>

More information about the issue you can find here.

My private opinion in a flash filter i mentioned on the beggining of this post we should change the way flash movie is embedded to the one Adobe is showing on their website.

In case of any questions please feel free to ask me for help its 1 minute problem.
--
kindest regards
Maciej Perlinski
http://www.meant4.com
http://www.meant4.pl
maciej.perlinski@meant4.com

Thanks for the quick reply

robskee - August 26, 2006 - 19:45

I changed it to php like you suggested, and now it displays properly on the testingflash blog post i made:

http://www.mancrabs.com/testingflash

However, it is still breaking the front page when I publish it to the front page. Here's a pic of what happens:

http://www.mancrabs.com/images/brokenfrontpage.jpg

If it makes things easier I can post the flash code here, let me know.

Thanks again for all the help.

404 Page Not Found

mac_perlinski - August 29, 2006 - 21:52

Well i m getting 404 Error trying to reach both links.

--
kindest regards
Maciej Perlinski
http://www.meant4.com
http://www.meant4.pl
maciej.perlinski@meant4.com

Cleaning things up a bit

arthurf - August 30, 2006 - 16:48

I did something similar, but tried to do things a bit more drupaly.

First, get the adobe files from here

Secondly, I put these into my theme directory in a scripts directory. This helps keep everything manageable.

In my case, my flash files are attached to a node. So I do the following:

  $file = array_shift($node->files);

  // if the file is flash, load the javascript flash loader
  if(strstr($file->filemime, "flash")) {
    drupal_add_js(path_to_theme() . "/scripts/AC_RunActiveContent.js");
    print "<script type='text/javascript'>AC_FL_RunContent( 'codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','src','/" . print str_replace(".swf", "", $file->filepath) ."','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','" . str_replace(".swf", "", $file->filepath) ."');</script>";
  }

Note that you have to remove the .swf from the file name to run it.

You might also want to look at this post: http://drupal.org/node/66035 which describes how to modify the flash_filter to correctly work with IE

Good direction arthurf

mac_perlinski - September 6, 2006 - 13:21

Well my solution was quick working draft but as i said the situation should be changed more generally it would be nice to extend upload module to accept .swf file and works like with images to be able to just attache the swf to the node and have it displayed with adobe script. And the adobe script would be the part of module wich is extending the upload module. To be more clear i see flash filter to be rewriten and refactor to make it compilant with ie using the Adobe script and it should extend the upload form.

Its just the idea to make the life easier for people who are not developers and they dont want to change any drupal modules source.

Your step is totally in right direction =)
--
kindest regards
Maciej Perlinski
http://www.meant4.com
maciej.perlinski@meant4.com

Flash swf breaking in Drupal

mndonx - September 13, 2006 - 16:50

Hi - I've been having a similar problem; the swf (with several attached-- loadMovieNum --swfs and a txt file ) work just fine when I open the uploaded file in the browser, but when I embed that file in Drupal, the loadMovieNum and the loadVarsText commands stop working. I thought it might be the way I was embedding the file in the node, but I've tried it a lot of ways. Any suggestions?

Thanks!

New FlashVideo Module

travist - February 8, 2007 - 22:30

I just created a new module called FlashVideo that will do what you are asking for...

You can find it at www.drupal.org/project/flashvideo.

I have also written a complete tutorial at www.travistidwell.com/flashvideo.

Hope this helps.

Thanks for the Flashvideo

ulfk - March 18, 2008 - 09:24

Thanks for the Flashvideo module. I am a little intimidated by the lengthy install documents. Is this the best option for uploading and playing FLV files? i.e. no transcoding needed

 
 

Drupal is a registered trademark of Dries Buytaert.