每个唯一实例的 jQuery 音频音量
我有一系列 html5 音频播放器(动态生成),我用 jquery 滑块调整音量。我遇到的问题是移动一个滑块会改变所有滑块的音频输出音量。它不会更改每个实例的音频设置。我想知道是否有人可以帮助我,这样它只会影响它所绑定的音频播放器。
//volume audio
$(document).ready(function () {
audio = $("#<?php echo $track_id; ?>").get(0);
audio.volume =<?php echo $trackVolume; ?>;
$("#volumeAudio<?php echo $track_id; ?>").each(function() {
$( this ).empty().slider({
value: <?php echo $trackVolume; ?>,
orientation: "horizontal",
range: "min",
max: 1,
step: 0.1,
animate: true,
slide: function( event, ui ) {
audio.volume = ui.value;
$.post(
"processForms/process_presentation.php", { presentationProcessing: 'updateAudioSliderVolume', presentationId: <?php echo $pres_id; ?>, trackID: <?php echo $track_id; ?>, sliderValueVolume: ui.value}
);
}
});
});
});
I have a series of html5 audio player (dynamically generated), that I adjust the volume with a jquery slider. The problem I am having is that moving one slider changes the audio output volume for all. It does not change each instances audio setting. I wonder if anyone could help me with this, so that it only effect the audio player it is tied to.
//volume audio
$(document).ready(function () {
audio = $("#<?php echo $track_id; ?>").get(0);
audio.volume =<?php echo $trackVolume; ?>;
$("#volumeAudio<?php echo $track_id; ?>").each(function() {
$( this ).empty().slider({
value: <?php echo $trackVolume; ?>,
orientation: "horizontal",
range: "min",
max: 1,
step: 0.1,
animate: true,
slide: function( event, ui ) {
audio.volume = ui.value;
$.post(
"processForms/process_presentation.php", { presentationProcessing: 'updateAudioSliderVolume', presentationId: <?php echo $pres_id; ?>, trackID: <?php echo $track_id; ?>, sliderValueVolume: ui.value}
);
}
});
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改
为
Change
To