problem about html5-audio-Collection of common programming errors


  • Paul
    javascript jquery html html5-audio
    I would like to know how to mute all audio within a specific div class. This is mainly to mute ads playing unexpected videos or commercials on my site. I have the all of the ads under the div class “muted” so I would like to mute those divs but still allow for youtube videos (obviously outside the divs) to play the audio. Any help is appreciated.. Thanks

  • Angelo Lupo
    php mongodb audio-streaming html5-audio
    I wrote a little audio streamer based on mongo and php with a player in HTML5. Every time I play something audio suddenly stops. I’m using php 5.3.3-1 as server on xubuntu 13.04 and MongoDB, everything is streamed locally. The code is on github at this address: link<?phprequire(“core/core.php”);$id = $_GET[‘id’]; $x = Track::object($id);header(“Content-Type: {$x->mime}”); header(“Content-Description: File Transfer”); header(“Content-lenght: {$x->size}”); if ( !empty($_GET[‘download’]) )

  • srynznfyra
    css audio html5 html5-audio
    I’m building a music player web application which implements the HTML5 audio tag, however would like it to look consistent across browsers – is it possible to define my own custom CSS? And how?cheersFela

  • jz999
    javascript google-chrome audio html5-audio web-audio
    We are making an web based music editor and mixer based on the Web Audio api. Users can mix together multiple tracks, crop tracks, etc. The actual mixing together of the tracks just involves playing back all the sources at once. We want to be able to add the option to save the mix and make it available for download to a user’s computer. Is there some way to do this on the front end (like connecting all the sources to one destination/export node), or even the backend (we are using RoR)?

  • alex
    javascript jquery memory-leaks html5-audio
    I wrote a bit of JavaScript with jQuery that loads a sound file with the HTML 5 <audio> tag and on a mouse click starts playing a new instance of that sound file (so that it can be played multiple times in parallel/overlay).HTML:<audio id=”audiotemplate” src=”audio/myfile.ogg”></audio>JavaScript:mybutton.click(function() {$(‘#audiotemplate’).clone()[0].play(); });This works as intended, but creates a memory leak that causes FF to eat up the system RAM and Chromium to show its “

  • zoonosis
    javascript html5 html5-audio web-audio
    I was planning on using wavesurfer.js in a project of mine so I checked out the demo on http://wavesurfer.fmI dropped a large mp3 file (around 2 hours) onto the middle of the page that asks for a file. It seems to want to load it but after a while Chrome comes up with an error. It doesnt crash, just the tab fails.With smaller files, single songs, it seems to work ok.So there seems to be either some limitations with html5 web audio or the websurfer.js library but im not sure. Does anyone have any

  • Moshe S
    html5 firefox cross-browser opera html5-audio
    I have an html5 audio tag in my webpage:<div id=”audioContainer”> <audio id=”siteAudio” src=”http://myDomain.com/audio/soundFx.mp3″ type=”audio/flac” preloading=”auto” audio=”true”></audio> </div>I would like to be able to play the sound from a different starting point every time the user presses a different button on my site. Creating sound fx for clicks. I’m using the following JS code to do this:var m_currentAudioElement = document.getElementById(‘siteAudio’);m_curr

  • Karen Peng
    html5 google-chrome audio html5-audio web-audio
    I have a button. Every time it is clicked, a music is played. When it’s clicked the second time, the music resumes. I also want to visualize the music.So i begin with html5 audio (complete code in http://jsfiddle.net/karenpeng/PAW7r/):$(“#1”).click(function(){audio1.src = ‘1.mp3’;audio1.controls = true;audio1.autoplay = true;audio1.loop = true;source = context.createMediaElementSource(audio1);source.connect(analyser);analyser.connect(context.destination);});But when it’s clicked more than once,

  • alisamii
    javascript media-player html5-audio font-awesome
    I am trying to develop a very minimal audio player with just a play/pause button and a mute/unmute button.I want to use Font-Awesome to display icons for play/pause and mute/unmute.I have created a fiddle where I have put my code. http://jsfiddle.net/EsC6L/I am getting an error “Uncaught SyntaxError: Unexpected Identifier”The console is identifying the syntax in the innerHTML as incorrect.btnPlayPause.addEventListener(“click”, function() {if (myAudio.paused) {myAudio.play();btnPlayPause.innerHTM

  • Cracker0dks
    javascript html5 buffer decode html5-audio
    I want to play audio data from an ArrayBuffer… so I generate my array and fill it with microfone input. If I draw this data on a canvas it looks like –> So this works!But if i want to listen to this data withcontext.decodeAudioData(myArrayBuffer, function(bufferN) {var out = context.createBufferSource();out.buffer = bufferN;out.connect(context.destination);out.noteOn(0); }, errorFunction);I dont hear anything… because the errorFunction is called. But error is null!I also tryed to get the b

  • karley
    javascript settimeout html5-audio
    I have a reference to an audio tag whose play method I can call like so:voice[“blessed be”].play()if I try to call it like:setTimeout(voice[“blessed be”].play, 1000)I get:Uncaught TypeError: Illegal invocationI’m not necessarily going to use setTimeout in the final implementation; but, why doesn’t this work?

  • oxxi
    javascript html5 html5-audio web-audio
    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%20meod

  • sonill
    javascript jquery ios html5-audio soundmanager2
    I am having trouble playing sound manager 2 in mobile devices. The following code works preety good in desktop but not in mobile devices ( i tested in ipad) i have heard that ios doesnot play with out user interaction but as you can see in code below, the sound only plays when user click in #play button. so why does ios still throw this error “suspend, playback suspended”var $play = $(‘#play’); var $pause = $(‘#pause’); var $prev = $(‘#prev’); var $next = $(‘#next’); var $repeat = $(‘#repeat’);

  • LiberalArtist
    jquery html5 wordpress jquery-ui html5-audio
    I’m working on an interface for <audio>, and I’m working with JQuery UI’s slider to provide the seek and volume functionality.I actually have an ugly little mockup of it which works just fine; I’ve posted it here. (If you fiddle with it, you’ll want to interact with “Instance 2,” which links to sources elsewhere on the web. “Instance 1” refers to source files in the same directory as the html document, and I haven’t uploaded those.)The problem comes when I try to implement this (slightly m

  • user888734
    javascript html5 html5-audio webkitaudiocontext
    I’m trying to create a graphic equalizer type visualization for HTML5 audio – Chrome only at this point, using webkitAudioContext.I’m finding unusual and unpredictable behaviour when I try to change the source of the audio i.e. to play a different song. I read somewhere I should wait until the “canplay” event on the audio is triggered before connecting it to the context / analyser:var context, sourceNode, analyser, javascriptNode, audio;var ctx = $(“#songcanvas”).get()[0].getContext(“2d”); fu

  • Kasper Isager
    jquery custom-controls html5-audio
    I’ve built a custom HTML5 audio player using jQUery according to the guide found here: http://neutroncreations.com/blog/building-a-custom-html5-audio-player-with-jquery/My script is as follows:jQuery(document).ready(function() {audio = jQuery(‘div#artificial-brothers audio’).get(0);loadingIndicator = jQuery(‘div#artificial-brothers #loading’);positionIndicator = jQuery(‘div#artificial-brothers #handle’);timeleft = jQuery(‘div#artificial-brothers #timeleft’);if ((audio.buffered != undefined) &

  • Ramin
    javascript android ios html5 html5-audio
    I am trying to get an audio to play in all possible modern browsers, including ios and android.I have written a function to play either an ogg or mp3 assuming I have both versions on the server:audio_template = Handlebars.compile(‘<audio autoplay>’ +’ <source src=”{{ src }}.mp3″>’ +’ <source src=”{{ src }}.ogg”>’ +'</audio>’);/* No extention–assuming both ogg and mp3 are present. */ function playAudio(src) {var audio = new Audio();if (audio.canPlayType(‘audio/mp3’) {

  • Yahreen
    javascript jquery jquery-ajax audio html5-audio
    I’m attempting to play a sound on hover for content loaded via Ajax based on the “overlapping” method found here: http://css-tricks.com/play-sound-on-hover/:function audioController(){ $(“a”) // loop each menu item.each(function(i) {if (i != 0) { // only clone if more than one needed$(“#hover”).clone().attr(“id”, “hover-” + i).appendTo($(this).parent());}$(this).data(“beeper”, i); // save reference}).mouseenter(function() {$(“#hover-” + $(this).data(“beeper”))[0].play();}); $(“#hover”).attr(“id”

  • Jonas T
    javascript jquery audio mp3 html5-audio
    I have the following code to play audio on my website. The problem is playing audio does not stop or pause to play a new one. All the files are playing together like crazy.$().ready(function () {PlayMp3(‘sounds/file1.mp3’);PlayMp3(‘sounds/file2.mp3’);PlayMp3(‘sounds/file3.mp3’);PlayMp3(‘sounds/file4.mp3’); });function PlayMp3(file) {var isiPad = navigator.userAgent.match(/iPad/i) != null;var isiPhone = navigator.userAgent.match(/iPhone/i) != null;var isiPod = navigator.userAgent.match(/iPod/i) !

  • Toji
    javascript html5 html5-audio
    I’ve been playing with HTML5 audio recently, and though I can get it to play the sound it only ever will play once. No matter what I try (setting the properties, event handlers, etc) I can’t seem to get it to loop.Here’s the basic code I’m using://myAudio is declared at a global scope, so it doesn’t get garbage collected. myAudio = new Audio(‘someSound.ogg’); myAudio.loop = true; myAudio.play();I’m testing using Chrome (6.0.466.0 dev) and Firefox (4 beta 1), both of which seem happy to ignore my

  • Iyad
    javascript html5 javascript-events html5-audio
    I’m running into an annoying error, basically I’m using a 3rd party editor to run a simple a game, I’m starting an audio file at the start of the scene, and after the audio ended i want to goToNextScene() which is a built in function. I am using Buzz JavaScript library. However I’m running into problem with this. if i attach the event listener directly to the sound var i get an “‘undefined’ is not a function” error.var SceneSound = new buzz.sound(“…/something.m4a”); SceneSound.play(); SceneSou

  • yolise
    html5 controller html5-audio
    I’ve been absolutely everywhere (I think) and can’t seem to find a way to call a stop event in an html5 audio controller. My audio controller has a playlist where each track will play when selected or cycle through each track to the next. There’s also a next button which works.My play/pause button looks like this:` function playPause() {var audioPlayer = document.getElementsByTagName(‘audio’)[0];if(audioPlayer!=undefined) {if (audioPlayer.paused) {audioPlayer.play();} else {audioPlayer.pause(

  • Danny
    javascript html5 safari html5-audio
    I am trying to figure out why the code below works fine in Safari mobile and Chrome, but causes an error in Safari desktop for Windows.var _element = document.createElement(“audio”); _element.setAttribute(“src”, “myaudiofile.m4a”); _element.play();This code throws the following error:TypeError: ‘undefined’ is not a function (evaluating ‘_element.play()’)What’s weird is that I haven’t changed this code in months, and at some point it was working great in Safari desktop. It still works fine when

  • Joost Baaij
    javascript html5 html5-audio
    I am trying to play a sound in Safari on a special event. This is what I am doing<html><head><in a js file>if(event)document.getElementById(‘sound’).play();</in a js file></head><body> <audio id=”sound” src=”pling.mp3″></audio> </body> </html>The sound pling.mp3 is in the the same folder as the html file.The result in Safari developer console is: TypeError: Result of expression ‘document.getElementById(‘sound’).play’ [undefined] is n

  • Matteo Ciman
    javascript jquery safari html5-audio
    I am working with HTML5 audio tag with this simple code:HTML<audio id=”audioFrenata”> <source src=”sounds/frenata.ogg”> <source src=”sounds/frenata.mp3″></audio>JS$(‘#audioFrenata’).on(‘ended’, function() {manageImageObjectsLevel();}).get(0).play();with Chrome this works as expected, with Safari 5.1.7 on Windows and Safari on iPad 3 I receive this: ‘undefined’ is not a function (evaluating ‘$(‘#audioFrenata’).on(‘ended’, function() { manageImageObjectsLevel(); }).get(0).p

  • DuncanNZ
    javascript jquery html5 css3 html5-audio
    Here’s my goal: To have autoplay audio stopped when a Zurb Modal window disappears.I’m new with doing this stuff, especially javascript!I have a Zurb Modal window functioning as a splash screen that pops up on page load. I have HTML5 audio in the window that autoplays (it was a request – I don’t like autoplay!). The window disappears when the background is clicked, but the audio continues to play. I don’t know how to get the audio to stop! If anyone has an idea, I’d really appreciate hearing abo

  • spanjeta
    firefox html5-audio mediaelement.js shoutcast
    The shoutcast stream not working using mediaelement js audio player on latest firefox 21. Its working on other browsers like Chrome and IE.You check the link below. It was working earlier with older Firefox.Test link

  • John Smitt
    google-chrome safari html5-audio webkitaudiocontext
    I trying in console (chrome) webkitAudioContext and it’s defined (function with native code).webkitAudioContext function AudioContext() { [native code] }In safari (5.1.6) it’s returns ‘message: “Can’t find variable: AudioContext”‘.AudioContext Error line: 2 message: “Can’t find variable: AudioContext” sourceId: 4569334656 __proto__: ErrorwebkitAudioContext Error line: 2 message: “Can’t find variable: webkitAudioContext” sourceId: 4647161912 __proto__: ErrorCan I use webkitAudioContext in safari?

  • Jair-Rohm Parker Wells
    javascript html5 audio html5-audio
    Can anyone figure out why this declaration of a FileReader object returns undefined? console.log(“this is f ” + f);console.log(f);var reader = new FileReader(); var ref = reader.readAsArrayBuffer(f); console.log(ref); console.log(“the reader object is ” + reader.length);//why does reader not have a length property?Here’s my jsFiddle: http://jsfiddle.net/trkkazulu/6bV63/Thanks, J. Wells

Web site is in building