Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using audio field and soundmanager2 player everything works fine when logged in, but after logging out the player stops working. On closer inspection firebug showed the following errors:
TypeError: window.Animator is undefined
TypeError: threeSixtyPlayer is undefined
Comparing the source of a logged in page vs a logged out page showed that the following javascript files where not included in the correct order:
/script/soundmanager2.js
/demo/360-player/script/360player.js
Still an issue on 7.x-1.0
Comment | File | Size | Author |
---|---|---|---|
#8 | audiofield.players.inc_.patch | 807 bytes | robert.kandzia |
#1 | audiofield-fix-js-weight-for-soundmanager2-2143985-1.patch | 946 bytes | evoltech |
Comments
Comment #1
evoltech CreditAttribution: evoltech commentedComment #2
jucedogi CreditAttribution: jucedogi commentedThis didn't work for me on 7.x-1.0.
What actually worked was placing the line:
drupal_add_js($player_base_path . '/script/soundmanager2.js');
After the other drupal_add_js commands:
drupal_add_js($player_base_path . '/demo/360-player/script/berniecode-animator.js');
drupal_add_js($player_base_path . '/demo/360-player/script/360player.js');
So basically you end with at line ~250 of audiofield.players.inc:
drupal_add_js($player_base_path . '/demo/360-player/script/berniecode-animator.js');
drupal_add_js($player_base_path . '/demo/360-player/script/360player.js');
drupal_add_js($player_base_path . '/script/soundmanager2.js');
Comment #3
jucedogi CreditAttribution: jucedogi commentedComment #4
imonemus CreditAttribution: imonemus as a volunteer commentedI found that it was necessary to weight the 360player.js line to ensure that it is loaded after the berniecode-animator.js, i.e. so that they are loaded in the exact order they appear in the audiofield.players.inc file.
Mine works only if I have:
drupal_add_js($player_base_path . '/script/soundmanager2.js', array('weight' => 0));
//360 viewer
drupal_add_js($player_base_path . '/demo/360-player/script/berniecode-animator.js', array('weight' => 1));
drupal_add_js($player_base_path . '/demo/360-player/script/360player.js', array('weight' => 2));
Anyone agree? If so, I'll happily make a new patch.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous at Websolutions Agency commentedTested & patch ported.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous at Websolutions Agency commentedPatch pushed to git.
Comment #8
robert.kandzia CreditAttribution: robert.kandzia commentedI got this error on the version 7.x-1.2. You have to change the weight of JS file upload.