0
중지 버튼을 추가하고 싶습니다. 현재 재생 및 일시 정지 버튼 만 있지만 정지는 실제로 음악을 버퍼링하는 브라우저가 아니지만 처음으로 이동하지는 않습니다. MP3 파일은 아마도 정상이지만 라이브 스트림에는 없습니다. 누군가 나를 도울 수 있습니까? 고맙습니다.HTML5 오디오 태그 중지 버튼, 실시간 MP3 스트림을 중지 하시겠습니까?
var pause = new Image();
pause.src = "pause.png";
var play_control = 0;
function playmusic() {
if (play_control == 0) {
document.getElementById('musikplayer').play();
document.getElementById('playbutt').src = 'pause.png';
play_control = 1;
window.setTimeout("playcontrol()", 0);
window.setTimeout("zeitanzeige()", 0);
} else {
document.getElementById('musikplayer').pause();
document.getElementById('playbutt').src = 'play.png';
play_control = 0;
}
}
function playcontrol() {
if(play_control == 1) {
if(
document.getElementById('musikplayer').currentTime
== document.getElementById('musikplayer').duration
) {
document.getElementById('playbutt').src = 'play.png';
play_control = 0;
} else {
window.setTimeout("playcontrol()",0);
}
}
}
function zeitanzeige() {
if(play_control == 1) {
var full = document.getElementById('musikplayer').duration;
var full_min = Math.floor(full/60);
var full_sec = Math.floor(full - (full_min * 60));
if(full_min < 10) {
full_min = '0' + full_min;
}
if(full_sec < 10) {
full_sec = '0' + full_sec;
}
var curr = document.getElementById('musikplayer').currentTime;
var curr_min = Math.floor(curr/60);
var curr_sec = Math.floor(curr - (curr_min * 60));
if(curr_min < 10) {
curr_min = '0' + curr_min;
}
if(curr_sec < 10) {
curr_sec = '0' + curr_sec;
}
document.getElementById('time').innerHTML = "" + curr_min + ":"
+ curr_sec + "";
window.setTimeout("zeitanzeige()",0);
} else {
document.getElementById('time').innerHTML = "00:00";
}
}
function vol(z) {
switch(z) {
case "1":
document.getElementById('musikplayer').volume = 0.2;
document.getElementById('vol1').style.background = '#c9c3c3';
document.getElementById('vol2').style.background = '#8d8585';
document.getElementById('vol3').style.background = '#8d8585';
document.getElementById('vol4').style.background = '#8d8585';
document.getElementById('vol5').style.background = '#8d8585';
break;
case "2":
document.getElementById('musikplayer').volume = 0.4;
document.getElementById('vol1').style.background = '#c9c3c3';
document.getElementById('vol2').style.background = '#c9c3c3';
document.getElementById('vol3').style.background = '#8d8585';
document.getElementById('vol4').style.background = '#8d8585';
document.getElementById('vol5').style.background = '#8d8585';
break;
case "3":
document.getElementById('musikplayer').volume = 0.6;
document.getElementById('vol1').style.background = '#c9c3c3';
document.getElementById('vol2').style.background = '#c9c3c3';
document.getElementById('vol3').style.background = '#c9c3c3';
document.getElementById('vol4').style.background = '#8d8585';
document.getElementById('vol5').style.background = '#8d8585';
break;
case "4":
document.getElementById('musikplayer').volume = 0.8;
document.getElementById('vol1').style.background = '#c9c3c3';
document.getElementById('vol2').style.background = '#c9c3c3';
document.getElementById('vol3').style.background = '#c9c3c3';
document.getElementById('vol4').style.background = '#c9c3c3';
document.getElementById('vol5').style.background = '#8d8585';
break;
case "5":
document.getElementById('musikplayer').volume = 1.0;
document.getElementById('vol1').style.background = '#c9c3c3';
document.getElementById('vol2').style.background = '#c9c3c3';
document.getElementById('vol3').style.background = '#c9c3c3';
document.getElementById('vol4').style.background = '#c9c3c3';
document.getElementById('vol5').style.background = '#c9c3c3';
break;
}
}
맞나요? ? 그것은 – user2110505
올바른인가요 :(작동되지는 – user2110505
VAR 정지 = 기능 (stopButtonAudio) { stopButtonAudio.pause() 작동되지 않으며, stopButtonAudio.currentTime = 0; \t \t stop.src = "stop.png을" ]. } stopButtonAudio 함수() { \t \t document.getElementById를 ('musikplayer이')) (일시; \t \t document.getElementById를 ('stopbutt')를 SRC = "stop.png를 ']. – user2110505