Embed再生問題
2208 ワード
embedはページに1回しかロードされず、srcが付与されると変更できません.ページを動的にembedを作成する必要があります.また、jquery-file-uploadは卵が痛いです.
<td id="audtd_<s:property value="#n.index" />" style="padding: 0px;">
<center>
<s:if test="#sent.audiosource==null">
<input id="audtd_<s:property value="#n.index" />"
class="audioupload" type="file" style="width: 150px;"
name="audiofile"
data-url="sent_null!addAudioFile?englishSentence.id=<s:property value="#sent.id"/>"
multiple />
</s:if>
<s:else>
<center>
<img class="showaudio" src="/els/resource/voice/sentence/sond/speak.gif"
path="/els/resource/voice/sentence/sond/<s:property value="#sent.audiosource" />" />
</center>
</s:else>
</center>
</td>
$(".audioupload").fileupload({
sequentialUploads : true,
done : function(e, data) {
var fileinput = $(this);
$.each(
data.result,
function(index, file) {
var val = data.result.text();
$($("#" + fileinput.attr("id"))).html(
"<center><img class='addwaudio' href='javascript:void(0)'
src='/els/resource/voice/sentence/sond/speak.gif'
path='/els/resource/voice/sentence/sond/"+ val.substring(
val.lastIndexOf("\\") + 1,val.length)+ "' /></center>"
);
$(".addwaudio").mouseover(function() {
$(this).css("cursor","pointer");
});
$(".addwaudio").click(function() {
$("#player").empty();
$("<embed src='"+ $(this).attr("path")+ "' autostart='true' playcount='1' ></embed>")
.appendTo("#player");
});
});
}
});