html5-audio

Audio tag bug(?) on Android Chrome

醉酒当歌 提交于 2019-12-10 22:24:17
问题 I'm making a simple counter, that has sound at the end. It works perfectly on desktop Chrome, but on Android's Chrome (ICS if that matters) it has a strange bug. Here is the code <!DOCTYPE html> <html lang="hu-HU"> <head> <meta charset=utf-8> <title>-</title> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> var snd; var buzzer; // refresh the counter, called every sec function refresh(time) { second = time % 60; $('#second').html(second < 10 ? '0' +

Web Audio API: seek, play-/buffer-progress

不想你离开。 提交于 2019-12-10 22:16:07
问题 When you play audio using the audio element in Chrome you get annoying clicks and cracks. At least under my 64bit Linux installation, even after I formatted and installed a new Fedora version. (Firefox and Opera are fine, even IE9 in a VirtualBox Windows 7.) But demos using the Web Audio API instead of the audio element have perfect sound. So I was wondering if I could use the Web Audio API like the audio element? But there are some things you seem not to be able to do with this API. Or am I

Play live audio stream - html5

泪湿孤枕 提交于 2019-12-10 19:23:55
问题 I have a desktop application which streams raw PCM data to my browser over a websocket connection. The stream looks like this ...\\x00\\x00\\x02\\x00\\x01\\x00\\x00\\x00\\x01\\x00\\xff\\xff\\xff\\xff\\... . The question is simple: can I play such a stream in HTML with the Web Audio API / WebRTC / ...? Any suggestions are very welcome! code edit This code plays noise, randomly generated: function myPCMSource() { return Math.random() * 2 - 3; } var audioContext; try { window.AudioContext =

Limitations of HTML5 Audio on iOS 4? Playlisting, background, etc

心不动则不痛 提交于 2019-12-10 19:13:00
问题 I've been evaluating HTML5 audio on iOS 4 and have been trying to understand its limitations. From what I can tell... It is possible to play audio in the background It is not possible to fire JavaScript events in the background upon track completion It is possible to fire JavaScript events while the screen is off, but Safari must be in the foreground (before turning the screen off) My goal for this current project is to create a dynamic playlist that will continue to fire events and move to

How do you get the decibel level of an audio in Javascript

早过忘川 提交于 2019-12-10 17:26:25
问题 I am currently making a decibel meter visualizer using JavaScript, HTML and CSS. I have gone through several Web Audio API tutorials, but nothing on there is close to being specific to what I want to do. This is what I have so far: window.onload = init; function init() { var ctx = new webkitAudioContext() , url = 'https://dl.dropboxusercontent.com/u/86176287/pbjt.mp3' , audio = new Audio(url) // 2048 sample buffer, 1 channel in, 1 channel out , processor = ctx.createJavaScriptNode(2048, 1, 1)

load only metadata from html5 video/audio

谁说我不能喝 提交于 2019-12-10 16:11:35
问题 At first, I'd like to ask that question. I can not load metadata without any other video content. preload = "metadata" is not working. I test on Win Chrome and don't know how it works on Safari/FF/IE/Opera. Thus I can't load six and more video clips fast. Chrome may keep only six opened connections at similar port/protocol/domain. And if I load more than six videos then last videos does not start load while first six videos fully complete loading. Does jsfiddle need? I can create but I think

Can't directly have [audio].play() as a jQuery callback

对着背影说爱祢 提交于 2019-12-10 15:15:56
问题 Consider this code: var music = $("audio")[0]; //doesn't work $("#pbutton").click(music.play); //works $("#pbutton").click(function(){music.play()}); The line that doesn't work returns this error in Firefox: TypeError: 'play' called on an object that does not implement interface HTMLMediaElement. Am I missing something here? Why doesn't this work? Update: I made a fiddle for this. 回答1: That's actually pretty simple. I've updated your fiddle to show it. var x = { play: function() { console.log

js / html5 audio: Why is canplaythrough not fired on iOS safari?

若如初见. 提交于 2019-12-10 13:27:27
问题 i use the code below to preload an array of audio files (after user interacts with a button starting the process). After all audio files fired "canplaythrough" the code proceeds: var loaded = 0; function loadedAudio() { // this will be called every time an audio file is loaded // we keep track of the loaded files vs the requested files loaded++; console.log(loaded + " audio files loaded!"); if (loaded == audioFiles.length){ // all have loaded main(); } } function preloadsounds() { $("#loader"

Uncaught reference error BufferLoader is not defined

℡╲_俬逩灬. 提交于 2019-12-10 12:40:23
问题 Trying to learn the Audio API, but I get an Uncaught reference error for BufferLoader class. I'm on chrome and it's up to date. Shouldn't this class be working with no problems? <html> <head> <script type=text/javascript> window.onload = init; var context; var bufferLoader; function init(){ context = new webkitAudioContext(); bufferLoader = new BufferLoader( context, [ ' https://dl.dropboxusercontent.com/u/1957768/kdFFO3.wav', ' https://dl.dropboxusercontent.com/u/1957768/geniuse%20meodies

Web Audio API Stream: why isn't dataArray changing?

♀尐吖头ヾ 提交于 2019-12-10 12:08:20
问题 EDIT 2: solved. See answer below. EDIT 1: I changed my code a little, added a gain node, moved a function. I also found that IF I use the microphone, it will work. Still doesn't work with usb audio input. Any idea? This is my current code: window.AudioContext = window.AudioContext || window.webkitAudioContext; window.onload = function(){ var audioContext = new AudioContext(); var analyser = audioContext.createAnalyser(); var gainNode = audioContext.createGain(); navigator.mediaDevices