音频自动播放

时间:2015-03-18 00:58:55

标签: javascript jquery html

所以我在一分钟前就在这里寻找方法来做到这一点,并想出了这个......

$(document).ready(function() {
    var audioElement = document.createElement('audio');
    audioElement.setAttribute('src', 'mixtaperainbow.mp3');
    audioElement.setAttribute('autoplay', 'autoplay');
    //audioElement.load()

    $.get();

    audioElement.addEventListener("load", function() {
        audioElement.Play();
    }, true);

    $('.Play').click(function() {
        audioElement.Play();
    });

    $('.Stop').click(function() {
        audioElement.Stop();
    });
});

但是我不能不让它自动播放声音...有人请帮忙< 3

0 个答案:

没有答案