i am playing audio file through the code below in a jQuery Dialog through Quicktime. Everything is working fine but what i want to do is when i close the Dialog i want the audio file to stop too. in real its keep playing.
Code:
//Listen Music
$('.listenMusic').live('click', function(){
if($('div.ui-dialog').length){
$('div.ui-dialog').remove();
}
var path = $(this).attr('rel');
var $dialog = $('<div>', {
title: Listen
}).dialog({
autoOpen: false,
modal: true,
width: 400,
height: 100
});
var tab = '<table width="90%" style="margin: 10px 10%;"><tr><td><object codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"><param value="'+path+'" name="SRC"><param value="true" name="AUTOPLAY"><param value="true" name="CONTROLLER"><embed pluginspage="http://www.apple.com/quicktime/download/" controller="true" style="height:20px;width:300px;background-color:#D9EBFB" autoplay="true" target="myself" src="'+path+'"></object></td></tr></table>';
$('<div id="updateContent">').html(tab).appendTo($dialog);
$dialog.dialog('open');
return false;
});
this is the tag i used in above code
<object codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"><param value="'+path+'"
name="SRC"><param value="true" name="AUTOPLAY"><param value="true"
name="CONTROLLER"><embed pluginspage="http://www.apple.com/quicktime/download/"
controller="true" style="height:20px;width:300px;background-color:#D9EBFB"
autoplay="true" target="myself" src="'+path+'"></object>
why dont you just do this
Give "id" to your table
'<table id="myPlayer" width="90%" style="margin: 10px 10%;">
capture jquery Dialog close icon(*) event
$('div.ui-dialog').live("dialogclose", function(){
if($("#myPlayer").length){
$("#myPlayer").remove();
}
}):
This will remove it from dom which means your audio file is no longer exists so it will stop playing.