Active
Project:
jPlayer
Version:
7.x-2.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Sep 2017 at 13:51 UTC
Updated:
4 Sep 2017 at 13:51 UTC
Jump to comment: Most recent
Hello,
I have a problem with a Jplayer that I use in a block with this code:
$vars = array();
$vars['items'][] = array(
'url' => $node->field_extrait_audio[LANGUAGE_NONE][0]['uri'],
'ext' => 'mp3',
'type' => 'audio',
//'label' => 'Some music',
);
$vars['settings'] = array(
'mode' => 'playlist',
'solution' => 'html, flash',
'preload' => 'none',
'volume' => 100,
'muted' => FALSE,
'autoplay' => FALSE,
'repeat' => FALSE,
'continuous' => FALSE,
'backgroundColor' => '#fff',
'progressBar' => FALSE,
);
print theme('jplayer', $vars);
This code works, but my block uses the module "Block refresh" (https://www.drupal.org/project/block_refresh) to reload the block information regularly. When the block is refreshed, the player no longer works.
The JS console appears:
"Uncaught TypeError: Cannot read property 'solution' of undefined" in the jplayer.js file at this location:
$(player).jPlayer({
ready: function() {
Drupal.jPlayer.setFiles(wrapper, player, 0, playerSettings.autoplay);
// Make sure we pause other players on play
$(player).bind($.jPlayer.event.play, function() {
$(this).jPlayer("pauseOthers");
});
Drupal.attachBehaviors(wrapper);
// Repeat?
if (playerSettings.repeat != 'none') {
$(player).bind($.jPlayer.event.ended, function() {
$(this).jPlayer("play");
});
}
// Autoplay?
if (playerSettings.autoplay == true) {
$(this).jPlayer("play");
}
},
swfPath: self.settings.swfPath,
cssSelectorAncestor: '#'+playerId+'_interface',
solution: playerSettings.solution,
supplied: playerSettings.supplied,
preload: playerSettings.preload,
volume: playerSettings.volume,
muted: playerSettings.muted
});
How can I solve this problem?
Thank you in advance.
Comments