html5-audio

HTML5 Audio Player Duration Showing Nan

蹲街弑〆低调 提交于 2019-11-30 08:29:17
I just started to learn HTML5 and was going through HTML5 Audio player using JQuery. I coded a player with Playlist, everything works fine except the Duration with help of which my input range slider doesn't works. When I debugged I found that my duration is showing me NAN. I am setting the duration after the song is initialized. Here is my JS code jQuery(document).ready(function() { container = $('.container'); playList = $('#playlist'); playListSong = $('#playlist li'); cover = $('.cover'); play = $('#play'); pause = $('#pause'); mute = $('#mute'); muted = $('#muted'); close = $('#close');

Mixing two audio buffers, put one on background of another by using web Audio Api

一个人想着一个人 提交于 2019-11-30 08:22:30
问题 I want to mix two audio sources by put one song as background of another into single source. for example, i have input : <input id="files" type="file" name="files[]" multiple onchange="handleFilesSelect(event)"/> And script to decode this files: window.AudioContext = window.AudioContext || window.webkitAudioContext; var context = new window.AudioContext(); var sources = []; var files = []; var mixed = {}; function handleFilesSelect(event){ if(event.target.files.length <= 1) return false;

How can i create a promise for the end of playing sound?

≯℡__Kan透↙ 提交于 2019-11-30 08:05:52
问题 I have a simple JavaScript that loads sounds: prefix = 'modules/sounds/'; _sounds = ['nameOfSound','nameOfSound','nameOfSound']; for (var sound in _sounds) { if (_sounds.hasOwnProperty(sound)) { var cached = _sounds[sound]; cached.audio = new Audio(prefix + cached.src); } } } All is being cached here, and then in angular I just have a service that does the following function: this.play = function(trackName) { _sounds[trackName].audio.play(); }; What I want is a simple promise for the sound,

How can I avoid this 'clicking' sound when I stop playing a sound?

笑着哭i 提交于 2019-11-30 07:23:30
I really hope this question stays a programming question and do not end up an Sound Mechanics question... Here goes... I am doing some experiments in order to figure out how the Web Audio API works. What I am trying to do is a simple "Hang up phone" sound playing in a loop. The problem is that when the sound ends, you can hear a quite annoying 'clicking' sound. I cannot explain it better, but you can hear it if you test the code. Is there some way I could avoid this? Some filter I could apply or anything? var audioContext = new (AudioContext || webkitAudioContext)(); var frequencyOffset = 0

Phonegap mixing audio files

被刻印的时光 ゝ 提交于 2019-11-30 07:21:01
I'm building a karaoke app using Phonegap for Ios. I have audio files in the www/assets folder that I am able to play using the media.play()function This allows the user to listen to the backing track. While the media is playing another Media instance is recording. Once the recording has finished I need to lay the voice recording file over the backing track and I have no idea of how I might go about doing this. One approach I thought might work is to use the WEb Audio API - I have the following code which I took from HTML5 Rocks Which loads up the two files into an AudioContext and allows me

In HTML5, can I play the same sound more than once at the same time?

点点圈 提交于 2019-11-30 07:03:31
I'm making a game, in which sounds are often played. I noticed that a sound wont play again while it is being played. For example, the player collides with a wall, a "thump" sound is played. But, if the player collides with one wall, and then quickly collides with another wall, only one "thump" sound is played, and I believe that this happens because the first sound didn't finish. Is that true? How should I avoid this? I thought of preloading the sound three times, always playing a different copy of that sound, but this seems rather stupid... SOLVED: Turns out I was right... You need to

Mobile Safari: Audio + cache manifest

血红的双手。 提交于 2019-11-30 04:53:51
问题 I'm having a small web app, which plays really short sound bits on the click of several buttons. It explicitly targets mobile Safari on iOS (iPad). After reading here and elsewhere about the several "shortcomings" of HTML5 audio in this context on mobile Safari and trying a few "hacks" and tricks, I'm stuck with a situation where Safari seems simply (for the lack of a better word) broken: I can play sound A (it takes a long time for it to start — I'm assuming it's downlading [again]?) on the

HTML5 <audio> tag not working in Android Webview

。_饼干妹妹 提交于 2019-11-30 04:04:17
the HTML5 audio tag doesn't seem to work in the web view if the source file is stored locally. i.e. <audio controls="controls"> <source src="my_local_audio_file.mp3" type="audio/mpeg" /> </audio> It works when the file is accessed from a server like src="http://example.com/audio.mp3" I am trying it on Android ICS. There are a few workarounds as stated here . But i don't understand why this problem is occurring. Any solutions or insights as to why this is happening? Thank you. this is just alternet way to achieve goal to play audio from html file use Mediaplayer ( http://developer.android.com

playbackRate on AUDIO and pitch

梦想的初衷 提交于 2019-11-30 02:45:43
问题 Little bit of background: People like games. People use the internet. The internet needs games. Games use sound. HTML5 has <audio> . Okay, all good so far. Recently I discovered - to my surprise - that IE9 actually supports playbackRate. I eagerly gave it a try. Even more surprising, it actually worked. I tried the same in Chrome, and while it worked it was horribly grating when I set it to 0.5 . I've already ditched Firefox because it doesn't support MP3. Moving on, here's my question: both

synchronize and highlight HTML text to audio

邮差的信 提交于 2019-11-30 02:26:31
If necessary I can explain in more detail but essentially what I need to do is effect CSS changes to HTML text in sync with an audio track - i.e., highlighting words/phrases in sync with the audio playback. I also need to control the audio playback by clicking on the text. I have good HTML/CSS chops, but I’m not as strong with raw js, so I’m hoping there’s a jQuery approach. I’m hoping someone can steer me in the best direction. Many thanks in advance, svs For ease of use, I recommend a combination of jQuery and Popcorn.js for anything where you want to integrate media with HTML, and visa