Sorry, you need to install flash player to see this content

titouille - March 19, 2009 - 11:46
Project:SWFObject API
Version:6.x-1.0-beta1
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Hello,

drupal 6.10

I installed last version of swfobject drupal module (6.x-1.0-beta1), downloaded the swfobject library (v2.1) like explain in the readme file, put swfobject.js and expressInstall.swf into swfobject_api module folder, and finally add this code in "page" contemplate body :

<?php

$url
= "http://auto.titouille-local.ch/flex/drupalTest.swf";
$params = array('width' => 400, 'height' => 300 );
$vars =  array(
 
'file' => base_path() . path_to_theme() .'/files/song.mp3',
 
'image' =>  base_path() . path_to_theme() .'/files/image.jpg'
);
print
theme("swfobject_api", $url, $params, $vars);

?>

The source page include in the header the swfobject script :

<script type="text/javascript" src="/modules/swfobject_api/swfobject.js?y"></script>

The swfobject-1 div is like this :

  <div class="content">
    <div id="swfobject-1" class=" swfobject">Sorry, you need to install flash to see this content.</div>
  </div>

and at the bottom of the page, I have the following code :

<script type="text/javascript" src="/modules/swfobject_api/swfobject_api.js?y"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "swfobject_api": { "files": { "swfobject-1": { "url": "http://auto.titouille-local.ch/flex/drupalTest.swf", "params": { "type": "movie", "bgcolor": "#FFFFFF" }, "flashVars": { "file": "/themes/acquia_marina/files/song.mp3", "image": "/themes/acquia_marina/files/image.jpg" }, "attributes": [  ], "height": 300, "width": 400, "express_redirect": "modules/swfobject_api/expressinstall.swf", "version": "6", "bgcolor": null } } } });
//--><!]]>
</script>

I tested http://auto.titouille-local.ch/modules/swfobject_api/swfobject.js and swfobject js file is displayed so I think it's ok with the swfobject library.

I have tried with relative path ./flex/drupalTest.swf, /flex/drupalTest.swf, and full http path like in the code I wrote under, but no correct result... I don't understand what is wrong, because the js is included at the top of the page.

Any suggestion would be appreciated.

#1

arthurf - March 19, 2009 - 19:30

would you mind giving me a URL that I could look at where the code isn't working?

#2

titouille - March 23, 2009 - 09:28

Sorry but this is on a local installation. I'll see if I can put it on my local server and give you an url ;-)

#3

arthurf - March 23, 2009 - 09:48

If you have firebug installed, you can see if there are any JS errors that are happening that might prevent the loading of the SWF file. You might also want to try using a full url to your images and mp3- eg: url(path_to_theme() .'/files/image.jpg', array('absolute' => true));

Let me know if that helps.

#4

titouille - March 23, 2009 - 09:56

Re,

I tried to install same build on my local server and it work, all is ok. I don't know why it's broken on my local computer, but it seems ok on the server. Sorry for the disturbance :-|

#5

arthurf - March 23, 2009 - 09:58
Status:active» closed

I'm guessing it's a URL/domain issue- you might want to create a cross domain file, or making sure that your URLs are absolute

#6

George2 - March 25, 2009 - 16:42
Status:closed» needs review

i had exactly the same problem, and it came down to a templating issue.

i put $scripts right at the bottom of the template for performance reasons, like so:

...
...
...
    <?php print $closure; ?>
  </div>

<?php print $scripts; ?>
  </body>
</html>

this threw up a js error that "Drupal is not defined", and "JQuery is not defined"... so, moving the scripts above the closure did the trick. however, i don't want to do that as closure can contain html and for optimisation purposes, i'd like to have $scripts at the bottom.

in the swfobject_api_ensure_swfobject function, is there a particular reason why the last two js calls are added to footer?

i'd like to be brash, and suggest that the drupal add js's are moved to the header. i've tested with $scripts at the top, and $scripts at the bottom, and this does the trick

thanks

AttachmentSize
407142.patch 798 bytes

#7

arthurf - March 25, 2009 - 16:50
Status:needs review» postponed (maintainer needs more info)

As a general rule, I think $scrips needs to be displayed above $closure. In this case, You'd load settings and the controller function before the swfobject.js library is loaded, which I'd guess is the source of the problems. As far as I know, the common thinking at this point is to try to load as much of the JS in the footer as possible to decrease page load times. I'm fine to move things back to the header, but I have this functioning on a few sites where $scripts is displayed before $closure and it works fine for me. Can you give this a try? I'll try to duplicate your setup and see if that is the source of the errors.

#8

George2 - March 25, 2009 - 17:29

if i move $scripts before $closure, sure, it works fine. however, i don't think this is preferential, and so in the templates, i moved the $scripts after the $closure which causes problems for swfobj api.

the patch above fixes the problem.

#9

arthurf - March 25, 2009 - 17:33

Why don't you think this is preferential? Can you point me to some documentation so I can understand better where you're coming from? I'm not understanding what would be in $closure that would make you want to have it above $scripts?

#10

arthurf - March 25, 2009 - 17:39

Also, please see this article by Wim: http://wimleers.com/article/improving-drupals-page-loading-performance#a... as well as this: http://groups.drupal.org/node/8399#comment-25894

In both of these cases, they seem to be pretty clear that $scripts goes should before $closure. Again, I'm willing to be convinced otherwise, but at this point, I think the issue is how you've done the page structure- of course, that begs a question about how javascript is placed into the page template, but I'm not going there ;)

#11

George2 - March 27, 2009 - 01:25

bah humbug :p

#12

LateNightDesigner - April 2, 2009 - 08:48

I'm having the same problem as titouille. I receive a "Sorry, you need to install flash to see this content." This is on a live site, not a local installation.

My paths are absolute, as shown below:

<?php
$url
= "http://example.com/content/themes/fourseasons/site_banner.swf"; //path to flash file
$params = array('width' => 940, 'height' => 92 );
print
theme("swfobject_api", $url, $params);?>

#13

SeanBannister - April 30, 2009 - 01:20

I can confirm this problem and my $scrips is displayed above $closure

#14

robotjox - April 30, 2009 - 11:08

confirming too

#15

arthurf - May 5, 2009 - 03:02

What is the js that is being printed on your page?

#16

BlindWolf8 - May 12, 2009 - 04:59

Hello,
I am also having this issue when trying to post the PHP code in nodes or in a theme. However, I have no trouble when using it in a CCK Contemplate. I am using Drupal 5.16 and SWFObject API 5.x-2.0-beta3.

The JS gets called at the top of the page. I can confirm that code called using this module and a CCK Contemplate (referenced above) breaks when $scripts is called at the bottom of the page/template as other peopel in this thread were discussing.

Thanks for any info!

#17

BlindWolf8 - May 12, 2009 - 14:47

PS: I tried putting in code manually, and it works fine. I think it has something to do with Express Install not getting loaded right. Can anyone else confirm?

#18

tiato - October 31, 2009 - 07:01

I was using SWFObject to stream a remote SWF (NOT FLV) video tutorials. It was working fine until I updated Embedded Media Field which I use to add a custom URL field to content types.

I received this same error about installing flash player after updating Embedded Media Field module.

I was using the following config after update:
-Drupal 6.14
-Embedded Media Field 6.x-1.15
-SWFObject API 6.x-1.0-beta1

I tried #12 by editing the nodes, also disabled JW Player from EMF and it does play videos again but the weird thing is the html source doesn't look much different

Before #12 is applied this is the outpout:

<div class="emvideo emvideo-video emvideo-zzz_custom_url"><div id="swfobject-2" class=" swfobject">Sorry, you need to install flash to see this content.
</div>

After #12 is applied and the video is working (streaming again), the output is not much different:

</div>
<div id="swfobject-1" class=" swfobject">Sorry, you need to install flash to see this content.
</div>

I have verified that swfobject.js is being loaded though it is Aggregated and GZipped. I have also disables Java Aggregator and GZip to confirm that swfobject was loading.

Even the source footer seems fine:

  <script type="text/javascript" src="/sites/default/files/js/js_9ca15ca4d66b255b8c326fba276bdd39.jsmin.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "swfobject_api": { "files": { "swfobject-1": { "url": "http://php.opensourcecms.com/free/videos/drupal/drupal_blocks.swf", "params": { "type": "movie", "bgcolor": "#FFFFFF" }, "flashVars": [  ], "attributes": [  ], "height": "442", "width": "776", "express_redirect": "sites/all/modules/swfobject_api/expressinstall.swf", "version": "6", "bgcolor": null }, "swfobject-2": { "url": "/sites/all/plugins/jwflvmp/", "params": { "div_id": null, "allowFullScreen": null, "type": "movie", "bgcolor": "#FFFFFF" }, "flashVars": { "image": "/", "file": "http://php.opensourcecms.com/free/videos/drupal/drupal_blocks.swf", "autostart": "false" }, "attributes": [  ], "height": "442", "width": "776", "express_redirect": "sites/all/modules/swfobject_api/expressinstall.swf", "version": "6", "bgcolor": null } } } });
//--><!]]>
</script>

Did I mention the video is working and streaming? I'm still investigating why the error is still showing but figured I would share my results.

#19

morningtime - November 2, 2009 - 13:51

I was calling this from page.tpl.php, and then this line did not work:

drupal_add_js(drupal_get_path('module', 'swfobject_api') .'/swfobject.js', 'module', 'header'); in function swfobject_api_ensure_swfobject

Had to manually add such calls to tempalte.php instead.

#20

tiato - November 3, 2009 - 21:42

I was able to get video tutorials working properly again and eliminated the "Sorry, you need to install flash player.." error by manually inserting SWFObject using a custom input format that allows PHP filtering. I have concluded that the issue is isolated to the Embedded Media Field module and not an issue with SWFObject API, however, I am updating this issue in case anyone else comes across the same issue.

I used a simple SWFObject call which works great:

<?php
  $url
= "http://php.opensourcecms.com/free/videos/drupal/drupal_blocks.swf";
 
$params = array(
   
'width' => '776',
   
'height' => '442',
  );
 
  print
theme("swfobject_api", $url, $params);
?>

#21

Alan D. - November 19, 2009 - 07:01

In case people are using page.tpl.php - you wil never get this to work. It simply doesn't work that way :)

The $script & $closure variable is already created before the theme() function is called.

Anyway, another way (with a custom module) is:

<?php
/**
* Implementation of hook_init().
*/
function xxx_init() {
 
xxx_flash_header(); // empty for testing :)
}

function
xxx_flash_header($url = "/sites/all/modules/swfobject_api/test.swf") {
  static
$flash = NULL;
  if (empty(
$flash)) {
   
$params = array('width' => 844, 'height' => 230, 'bgcolor' => '#777777' );
   
$variables = array('foo' => 'bar');
   
$flash = '<div id="flash-container">'. theme("swfobject_api", $url, $params, $variables) .'</div>';
  }
  return
$flash;
}
?>

and then in your preprocess or theme ...

<?php
 
// in your theme page.tpl.php
 
print xxx_flash_header();
?>

This is to embed a single custom flash header.

 
 

Drupal is a registered trademark of Dries Buytaert.