Title: [Plugin: podPress] javascript error &#8211; B(I) is undefined
Last modified: August 20, 2016

---

# [Plugin: podPress] javascript error – B(I) is undefined

 *  Resolved [jnlawton](https://wordpress.org/support/users/jnlawton/)
 * (@jnlawton)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/)
 * I’m interested in knowing when the the podPress audio player plays. In order 
   to do this I need to add a listener. But before I do that I noticed a javascript
   error in the console when a page with a podpress audio player is present.
 * Error: B(I) is undefined
    Line: B(I).addListener(J, K)
 * If you look at the function B, you’ll see that its not returning anything.
 * This all takes place in:
 * plugins/podpress/player/1pixelout/1pixelout_audio-player.js
 * Any help would be appreciated.
 * [http://wordpress.org/extend/plugins/podpress/](http://wordpress.org/extend/plugins/podpress/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [ntm](https://wordpress.org/support/users/ntm/)
 * (@ntm)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427506)
 * This is a bug which does not occur in every blog (with podPress) and I have trouble
   to imagine why this error occurs in your blog.
    That is why I would like to know
   more about the circumstances. It could be helpful if you would tell me the name(
   or the URL) of the blog where the error happens.
 * So far my best guess is that the file 1pixelout_audio-player.js does not get 
   included into the page well. Maybe you will find the reference twice in the `
   <head>` section (or maybe an other file which is required does not get included).
 * Besides that I don’t know how you can determine whether one of the flash-based
   mp3 players of podPress is playing. These players e.g. 1pixelout_audio-player.
   js are 3rd party software. Dan (seek3r) has embedded these player and I have 
   updated one of them in the last year. But I guess you are on the right track.
   You can probably use this SWFobject library or methods of it to retrieve such
   information.
 * Regards,
    Tim
 *  Thread Starter [jnlawton](https://wordpress.org/support/users/jnlawton/)
 * (@jnlawton)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427510)
 * Hi Tim,
 * Here is a link to the weblog: [http://1800jesuschrist.org/](http://1800jesuschrist.org/)
 * You are right on the money on this. There are two instances of the audio-player.
   js being loaded on the homepage. I will check to see how this file is being added
   to the WP header in the PodPress plugin.
 * On a page with a single instance of the audio player, there is no error.
 * [http://1800jesuschrist.org/a-prayer-for-money-for-a-housing-settlement/](http://1800jesuschrist.org/a-prayer-for-money-for-a-housing-settlement/)
 * Thanks for your response.
 * -john
 *  Thread Starter [jnlawton](https://wordpress.org/support/users/jnlawton/)
 * (@jnlawton)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427511)
 * From podpress.php., line: 494
 * Yep, I’ll try and rewrite to use wp_enque_script and wp_localize_script() to 
   avoid loading multiple instances of player. I don’t need different config for
   each player. Not sure how that should be handled. Probably multiple config on
   a single page not supported… Thanks, for you feedback!
 *     ```
       function podpress_print_frontend_js() {
   
           // ntm: this way of loading a localized JS scripts is probably not very elegant but it works in WP version older than 2.3
           // I know that since WP 2.3 the function wp_localize_script() exists and when it is decided to raise the minimum WP requirement of this plugin then this  method will be used.
       ```
   
 *  Plugin Author [ntm](https://wordpress.org/support/users/ntm/)
 * (@ntm)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427520)
 * Hi John,
 * you have found the line which podPress uses to insert this JS section. But the
   problem and the solution to it is most likely in a file of the theme or a different
   plugin.
 * This is not the first time that such a duplicate js code section appears as you
   can read e.g. here: [http://wordpress.org/support/topic/plugin-podpress-duplice-javascript-in-head](http://wordpress.org/support/topic/plugin-podpress-duplice-javascript-in-head)
   
   In one case it was a plugin.
 * podPress uses the Action Hook wp_print_scripts to add this section and that alone
   causes no problems. But there are thmes and plugins which call the function wp_print_scripts()
   directly. Calling this function directly is not good practice. As I understand
   it, it is no API function. Inside this function is the the Action Hook with the
   same name `do_action( 'wp_print_scripts' );`.
    If you call this function directly
   then it will be executed. But wp_head() or get_header() in your theme call it
   too. In other words if you call wp_print_scripts() directly the action of the
   action hook ‘wp_print_scripts’ get executed twice during the page load and since
   podPress uses this hook, the result is an duplicate code section. (If another
   plugin would uses this Hook the section would be duplicated too. The prioblem
   is not limited to podPress)
 * Altering podPress files may probably help but is not the way to go and will last
   only until the next podPress upgrade.
 * Please, control whether the theme or a plugin calls wp_print_scripts() directly.
   the function wp_print_scripts().
 *  Thread Starter [jnlawton](https://wordpress.org/support/users/jnlawton/)
 * (@jnlawton)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427531)
 * I did manage to find a plugin that was resulting in duplicate .js file. It was
   a plugin called WP-Email. I will post a request to change wp_print_scripts to
   wp_enqueue_script
 * I have certainly made progress in getting rid of the js error.
 * The only page I see the error now is on the home page. I see the error when all
   plugins except PodPress are disabled
 * There should be a clue in the html as to why only on the home page…
 * Thanks
 *  Thread Starter [jnlawton](https://wordpress.org/support/users/jnlawton/)
 * (@jnlawton)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427532)
 * I just realized that there are no js errors if I do not try and attach a listener.
   The error I noted above is thrown if I try an attach a listener from within the
   HTML.
 * But, if I enter the same code in the console. There is no error.
 * Now, with that said, does anyone know how to determine via javascript when the
   play button is pressed? Per documentation and some googling I think the correct
   syntax is:
 *     ```
       podpressAudioPlayer.addListener('podPressPlayerSpace_1', 'PLAY', function() {       console.log("play!!");
       });
       ```
   
 * No error, but nothing showing up on the console either. =(
 *  Plugin Author [ntm](https://wordpress.org/support/users/ntm/)
 * (@ntm)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427533)
 * > I will post a request to change wp_print_scripts to wp_enqueue_script
 * It is only necessary to use the Action Hook wp_print_scripts instead of calling
   the function with the same name directly.
    For instance:
 *     ```
       function printmyscript() {
       	echo "\n <!-- print my script test --> \n\n";
       }
       add_action('wp_print_scripts', 'printmyscript');
       ```
   
 * > The error I noted above is thrown if I try an attach a listener from within
   > the HTML.
   >  But, if I enter the same code in the console. There is no error.
 * Maybe you try to add this listener to early. Maybe you add it before podPress
   initializes this player.
    I guess when you try the code via the console the page
   is completely loaded. podPress initialises the player via a JS below the download
   links.
 * Have you tried to add your code in the footer of the blog page?
 * (There exists a parameter in the wp_enqeue_script() function which you can use
   to make WP print JS into the footer)
 *  Thread Starter [jnlawton](https://wordpress.org/support/users/jnlawton/)
 * (@jnlawton)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427582)
 * This is resolved Thanks for you help on this. The error was a result of other
   plugins calling print script and making sure that the object was present before
   attaching a listener.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘[Plugin: podPress] javascript error – B(I) is undefined’ is closed to
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/podpress_f79938.svg)
 * [podPress](https://wordpress.org/plugins/podpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/podpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/podpress/)
 * [Active Topics](https://wordpress.org/support/plugin/podpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/podpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/podpress/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [jnlawton](https://wordpress.org/support/users/jnlawton/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-podpress-javascript-error-bi-is-undefined/#post-2427582)
 * Status: resolved