html5-audio

How can I use html5 audio tags to play local mp3s on Android using phonegap?

自闭症网瘾萝莉.ら 提交于 2020-01-01 05:27:05
问题 I am deploying on Android 4.4 with v19 of the Android SDK on phonegap. I have an mp3 file in the same folder as my index.html file that I want to play using html5 audio tags. <html> <body> <audio controls> <source src='sound.mp3' type='audio/mpeg'> </audio> </body> <script type="text/javascript" src="cordova.js"></script> </html> It doesn't work and fails with the following: I/AwesomePlayer( 124): setDataSource_l(URL suppressed) E/ ( 124): Failed to open file '/android_asset/www/sound.mp3'.

How do I play a sound when an element changes, like SO Chat does?

拟墨画扇 提交于 2020-01-01 04:38:06
问题 I want a sound to play when an element changes on a page. I know how to do this, but I can't get it to play only on the first change , and don't do it later, until the user focuses the window (tab) and blurs it again. My current code: var notif = new Audio('http://cycle1500.com/sounds/infbego.wav'); if (window.innerHeight === window.outerHeight) { $(window).bind('DOMNodeInserted', function() { notif.play(); }); } 回答1: Use a variable to represent whether the sound should be played or not. var

Web Audio API for live streaming?

瘦欲@ 提交于 2019-12-31 08:03:10
问题 We need to streaming live audio (from a medical device) to web browsers with no more than 3-5s of end-to-end delay (assume 200mS or less network latency). Today we use a browser plugin (NPAPI) for decoding , filtering (high, low, band), and playback of the audio stream (delivered via Web Sockets). We want to replace the plugin. I was looking at various Web Audio API demos and the most of our required functionality (playback, gain control, filtering) appears to be available in Web Audio API.

Why does Html5 audio load all songs from server on file load

泪湿孤枕 提交于 2019-12-31 05:30:10
问题 my local web application (using java spark framework) creates a Html5 report and some of the pages contain audio files that can be played. Originally this done purely via Html such as <audio controls="controls"> <source src="/Music/Melco\TestMusic\TestMusic\WAV\Music\David Ferrard\Across The Troubled Wave\02 - The Slave's Lament.WAV"> </audio> but it only worked if the music was in a subfolder of the Web applications root folder. So to get round this I created a symbolic link to the root

mp3 audio works in all browsers but not IE9

不问归期 提交于 2019-12-31 01:59:48
问题 I have three mp3 audio files that play fine in all browsers but play for only 1.x seconds in IE9 unless I change "controls" to "autoplay" in which case it plays just fine. I was then sent the original, unedited file in .wav format. I encoded it myself to mp3 but have the same problem. However, if I create my own mp3 audio file and insert it into the same markup, it works in all browsers, including IE9 with the "controls" attribute. I can only think there is something about the settings in the

How to loop sound in JavaScript?

旧城冷巷雨未停 提交于 2019-12-30 18:55:49
问题 I tried below code to play a sound in JavaScript for certain times but with no success, the sound plays just once, what is the problem? for(var i = 0; i < errors; i++){ PlaySound3(); } Function: function PlaySound3() { var audioElement = document.getElementById('beep'); audioElement.setAttribute("preload", "auto"); audioElement.autobuffer = true; audioElement.load(); audioElement.play(); }; HTML code: <audio id="beep"> <source src="assets/sound/beep.wav" type="audio/wav" /> </audio> 回答1: If

HTML5 audio won't play on mobile devices

﹥>﹥吖頭↗ 提交于 2019-12-30 09:32:21
问题 Dear HTML5 developers, I'm having some troubles with this HTML5 audio... So let's jump into it. ap = "<audio width='200' height='30' preload='auto' controls autobuffer>"; ap += "<source src='util/blob_audio.php?i=" + w + "&ogg=1' type='audio/ogg' />"; ap += "<source src='util/blob_audio.php?i=" + w + "&mp3=1' type='audio/mpeg' />"; ap += "</audio>"; I am generating it in JavaScript and a method returns it when needed. I guess I should not have to mention that "w" variable, that's a parameter

HTML5 audio won't play on mobile devices

守給你的承諾、 提交于 2019-12-30 09:32:14
问题 Dear HTML5 developers, I'm having some troubles with this HTML5 audio... So let's jump into it. ap = "<audio width='200' height='30' preload='auto' controls autobuffer>"; ap += "<source src='util/blob_audio.php?i=" + w + "&ogg=1' type='audio/ogg' />"; ap += "<source src='util/blob_audio.php?i=" + w + "&mp3=1' type='audio/mpeg' />"; ap += "</audio>"; I am generating it in JavaScript and a method returns it when needed. I guess I should not have to mention that "w" variable, that's a parameter

Html 5 audio tag custom controls?

我们两清 提交于 2019-12-28 05:07:53
问题 I feel like I'm taking crazy pills here because I can not figure out how to render the html 5 audio tag with custom controls. I have this html so far, and it works no problem: <audio controls preload='none'><source src='the url to the audio' type='audio/wav' /></audio> How do I get it to display ONLY the play button, and perhaps when playing, show the pause button in it's place. From what I read, By default, the element will not expose any sort of player controls. You can create your own

How to detect HTML5 audio MP3 support?

我只是一个虾纸丫 提交于 2019-12-28 03:40:20
问题 I know how to check in Javascript if HTML5 audio playback is available. But how do I specifically check if MP3 audio playback is available, as IE9 and Chrome support it, while Firefox and Opera do not. 回答1: You could either check the User-Agent and see what browser is being used or you could test support with Javascript. var a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); I got the above code from this page. return !!(a