• Resolved choibc

    (@choibc)


    I am using Ajax enabled theme which load posts without refreshing whole page. I am very happy with theme.
    But I found a problem related audio-player.
    Here is my finding.

    Following codes were not generated when load post with ajax.
    <script type="text/javascript">
    AudioPlayer.embed("audioplayer_1", {soundFile:"XXXX"});
    </script>

    I think below codes are affecting this issue.
    $this->footerCode .= 'AudioPlayer.embed("' . $playerElementID . '", ' . $this->php2js($playerOptions) . ');';

    Please help me to fix it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter choibc

    (@choibc)

    I fixed this issue like this.

    $playerElementID = "audioplayer_" . ++$this->playerID;
    				if (strlen($this->options["flashAlternate"]) > 0) {
    					$playerCode = str_replace(array("%playerID%", "%downloadURL%"), array($playerElementID, $actualFile), $this->options["flashAlternate"]);
    				} else {
    					$playerCode = '<p class="audioplayer_container"><span style="display:block;padding:5px;border:1px solid #dddddd;background:#f8f8f8" id="' . $playerElementID . '">' . sprintf(__('Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version <a href="%s" title="Download Adobe Flash Player">here</a>. You also need to have JavaScript enabled in your browser.', $this->textDomain), 'https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW') . '</span></p>';
    				}
    
    				/* ajax issue; ANDY
    				$this->footerCode .= 'AudioPlayer.embed("' . $playerElementID . '", ' . $this->php2js($playerOptions) . ');';
    				$this->footerCode .= "\n";
    				*/
    				$playerCode .= '<script type="text/javascript">AudioPlayer.embed("' . $playerElementID . '", ' . $this->php2js($playerOptions) . ');</script>'
    				$playerCode .= "\n";
    
    				return $playerCode;

    tylerwolff

    (@tylerwolff)

    This is exactly what I needed! It works perfect. I too am using an ajax layout that dynamically loads posts with the audio player (tylerwolff.com).

    Thank you!

    sandman1485

    (@sandman1485)

    Hey guys, this is giving me an error for the audio player.php file. Is there something I’m missing?

    FIXXEDDD

    Missing “;” at the end of this line:

    $playerCode .= '<script type="text/javascript">AudioPlayer.embed("' . $playerElementID . '", ' . $this->php2js($playerOptions) . ');</script>';

    Works perfectly. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Audio Player] AJAX theme and audio player’ is closed to new replies.