javascript - jwplayer not recognized in a drupal page -


i've inserted jwplayer in 1 of drupal website node can't use javascript api. work examples from here, , tried embed , setup javascript well.

here sequence of module's hook_nodeapi:

case 'view':   // irrelevant code   $node->content['body'] = array (     '#value' => "<div id='player'>loading player ...</div>",     '#weight' => 9,   );   drupal_add_js('sites/all/libraries/mediaplayer-5.7/jwplayer.js', 'file');   drupal_add_js('sites/all/libraries/mediaplayer-5.7/swfobject.js', 'file');   drupal_add_js("jwplayer('player').setup({     flashplayer: 'http://localhost:8088/sites/all/libraries/mediaplayer-5.7/player.swf',     file: 'http://localhost:8088/" . $node->field_video[0]['filepath'] . "',     height: 270,     width: 480   });", 'inline'); break; 

the 2 javascript files appended drupal page's html output, , div appears too, when comes inline script, error because jwplayer not recognized. scanned references , found out problem might in flash security issue, went flash player's global settings -> advanced -> trusted location settings , added player.swf, site web address , whole directory of jwplayer well. nothing changed.

how can solve problem? appreciate ideas.

console log of script error

got it. script must described below div, used drupal_add_js("javascript code", 'inline', 'footer'); instead of drupal_add_js("javascript code", 'inline');, because third parameter defaults 'header' if not specified.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -