In my view files, I have soundbites which i want to play through a jQuery Dialog using flowplayer. Everything works except the player does not show. I have narrowed the problem down to where I have to provide the url to where the player's SWF file is located. I for the life of me cannot determine what location the player is looking for.
To sum it up, my files are:
flowplayer script - /app/webroot/js/flowplayer/flowplayer-3.2.10.min.js
flowplayer SWF- /app/webroot/js/flowplayer/flowplayer-3.2.11.swf
Then I have the following:
// Within the default.ctp in /app/view/layouts:
<script type="text/javascript">
// Audio player information:
$(document).ready(function() {
$(".player").click(function() {
$("<div></div>").load($(this).attr("href")).dialog();
return false;
});
});
</script>
// Example in a view file where I am calling the model view:
<?php
echo $this->Html->link($this->Html->image("icons/control_play_blue.png", array("alt" => "Play audio file")),array("controller" => "surveys", "action" => "audioplayer","questions",$question['Question']['ivr_recording_file'], $question['Question']['mime']),array('escape' => false, "class" => "player"));
?>
// Within the controller:
/*
* Audio player for IVR audio files for the site:
*
*/
public function audioplayer($type,$audio,$mime) {
$this->layout = false;
//$this->autoRender = false;
// Determine what type of file it is so that we can get the location:
if($type == "ivr") {
$location = "";
} else {
$location = "";
}
$file = $audio.".".$mime;
$this->set(compact("file","type"));
}
// Lastly, within the view of the controller call (this is where the URL is wrong)
<script type="text/javascript">
$(document).ready(function() {
flowplayer("player", "flowplayer-3.2.11.swf");
});
</script>
<?php
echo $this->Html->Link("","/files/uploads/".$type."/".$file,array("id" => "player"));
?>