Home  >  Article  >  Web Front-end  >  加载音频Audio_html/css_WEB-ITnose

加载音频Audio_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:42:251011browse

        var cameraAudio = new Audio();
        cameraAudio.src = 'camera.wav';

         // 设置音频对象的属性,预加载视频
         var options_audio = {
            preload  : 'auto'
        }
        for(var key in options_audio){
            if(options_audio.hasOwnProperty(key) && (key in cameraAudio)){
                cameraAudio[key] = options_audio[key];
            }
        }

TIPS:

      1、循环播放  loop:'loop'

      2、自动播放  autoplay:'autoplay'

      3、preload  : 'auto'为预加载

 

     相关操作:

     1、播放   xxx.play()

     2、暂停   xxx.pause()

 

 

文件下载:点击下载

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn