html5-audio

HTML5 Audio Player: How to select by HTML elements instead of div ID's?

泄露秘密 提交于 2019-12-10 11:58:38
问题 Making an html5 player, I'm moving away "from divs with id's" towards "simple html elements". Old Situation (works) <audio src="track1.mp3" id="audio"></audio> <controls> <play id="play" style="display:none">PLAY</button> <pause id="pause" style="display:none">PAUSE</button> <div id="progress"><div id="bar"></div></div> </controls> Javascript gets elements by divs with an id var myAudio = document.getElementById('audio'); var play = document.getElementById('play'); var pause = document

iPhone HTML5 Audio tag not working

旧城冷巷雨未停 提交于 2019-12-10 10:09:25
问题 I have a problem with an audio tag not working on an iPonhe. It plays HTML5 Audio tags when tested on W3Schools website but will not work with my one below <audio autoplay ><source src="audio/alarm1.mp3" type="audio/mpeg"></audio> This code works fine on desktop and android browsers, just not ipod or iphone safari EDITED It would seem that the audio file is working ok, it just will not autoplay Is there a way I could let the user press a button and there after play the music when ever it is

How to synthesize audio using HTML5/Javascript on iPad

和自甴很熟 提交于 2019-12-10 09:27:06
问题 Has anybody out there got working sample code that synthesizes (and plays) audio using HTML5/Javascript on Mobile Safari on the iPad? I have found some examples for javascript-based sound synthesis on the web, but they all seem to work in Firefox only. 回答1: Recently I came across this js-library, I think this is what you want -> https://github.com/oampo/Audiolet 回答2: Here is an example that works for me on an iPad: www.cse.usf.edu/~turnerr/sound_demo.html You can download the files from http:

How can I play .spx file by html5 ?

瘦欲@ 提交于 2019-12-10 04:22:44
问题 from html5 spec, it seem support spx: http://dev.w3.org/html5/spec-preview/the-source-element.html Using: But from my trying, it can't play in both Firefox 17 and Chrome, could you help ? 回答1: I have found that speex.js on GitHub (https://github.com/jpemartins/speex.js) can solve your problem. With speex.js you can demux & decode speex file (*.spx or *.ogg) to wav on fly, which is supported by both Chrome/Firefox and many other modern browsers HTML5 ready. In your html include thoese *.js

How can I tell if an HTML5 Audio element is playing with Javascript

时间秒杀一切 提交于 2019-12-10 03:34:12
问题 I have an audio element in a webpage, and I want to ensure that a user is not still playing it when they leave the page. How can I be sure the audio element is not playing when the page is unloaded? So far, I have the following code, but it doesn't seem to work; the dialog that pops up upon unload reports that playing is false even when the audio is playing: <!DOCTYPE HTML><html> <head> <script><!-- Loading Scripts --> function unloadTasks(){ if (playing && !window.confirm("A podcast is

Web Workers: SetInterval and SetTimeout reliability

吃可爱长大的小学妹 提交于 2019-12-10 02:20:33
问题 In a browser environment, setTimeout and setInterval aren't reliable for accuracy - where time sensitivity is an issue. Recently, we've been given requestAnimationFrame , which allows us to do a little better (in terms of performance.now() and its timestamps). Long story short - I decided to build a metronome in Javascript, and while it works, it's fairly inaccurate above a certain tempo. While compensating for late frames allows the tempo not to desync over time, the individual beats are

HTML5 Audio display only play pause and mute buttons

被刻印的时光 ゝ 提交于 2019-12-10 01:00:45
问题 I'm wondering if there's a quick and simple way to style the HTML5 audio element to display what I want. I was wondering if you could turn certain controls on and off, but that doesn't seem to be the case. I do not want a progress/track bar, or to display the time left. I just want a simple play/pause toggle button, and a mute/unmute toggle button. That's all! Any ideas? 回答1: Use this code it will serve your purpose. <!DOCTYPE html> <html> <body> <audio id="player" src="horse.ogg"></audio>

How can I play .3gp audio file in HTML

落花浮王杯 提交于 2019-12-09 18:31:52
问题 I am using simple HTML5 audio tag. For .mp3 file it is working fine. But I want to play .3gp file. <audio controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> </audio> 回答1: Browsers support only limited audio formats. see http://caniuse.com/#search=audio 3GP files are not playable in all browsers. Convert 3GP files to MP3 files, for example using Audacity audio editor. 回答2: You have to use video tag for video, because 3gp is a video extension. <source

How do I make a loading bar for an HTML5 audio element?

≯℡__Kan透↙ 提交于 2019-12-09 17:14:36
问题 I'm trying to make a loading bar (showing percentage loaded/buffered) for an HTML5 audio element. For the video tag it's possible to calculate using the following: video.buffered.end(0) / video.duration But I can't get this to work with the audio tag. It just returns a fix value. Any idea? Thanks! 回答1: Calling end method on buffered without checking is unreliable. It's possible you're trying to call the method on nothing. Check this fiddle: document.querySelector('span').innerHTML = document

Automatic audio sprite generator for web/javascript?

旧巷老猫 提交于 2019-12-09 07:33:27
问题 Audio sprites (several audio bites concatenated in one audio file) are getting common in javascript control of audio on the web. However, it takes quite a lot of "stupid" work to create and implement an audio sprite. Is there a tool or method by which you could do it automatically instead of "manually"? E.g. given a folder with audio files, I want a tool that generates An audio file with all the contents, preferably separated by a bit of silence. The onset and offset timings (in milliseconds)