html5-audio

Best way to embed audio in a webpage?

南楼画角 提交于 2019-12-01 17:29:10
问题 I know, I know. It sounds horrific, but it's what the client wants, and they're very set on the idea. It's now come to me to figure out the best way make it happen. Flash would be ideal but the client wants to avoid using it. It's a digital audio file, so I can convert it to any format that might make things easier (e.g. MP3 or OGG) but it needs to support IE 8+, FF 3.5+, Safari and Chrome at the very least. It needs to autoplay, have hidden controls (I know, I know) and hopefully it will

How to play base64 audio data on firefox with using HTML5?

时光总嘲笑我的痴心妄想 提交于 2019-12-01 17:00:34
问题 I'm trying to encode an mp3 file in base64 format. Then play it through the broswer. It works perfectly on safari and chrome, but not on Firefox . My question is "is there any way that make firefox play an audio file in base64/ binary string format?" ps: i know firefox can't play mp3, so i've tried others audio file like wav, ogg... None of them is working on Firefox after I have encoded them to base64. Please help <body> <div> <form> Select a file: <input type="file" name="img" id="myaudio"/

How to play audio in background with firefox os?

我怕爱的太早我们不能终老 提交于 2019-12-01 16:48:29
In my manifest file I've add the audio-channel-content in permissions: "permissions": { "audio-channel-content":{"description":"Use the audio channel for the music player"} } In my index.html I've got an audio tag like: <audio mozaudiochannel="content" preload="none" src="http://my-stream-url"></audio> I can play my audio stream during 2mn: The first one when the phone is unlock. After 1mn my phone auto-lock the screen and it continue playing for another minute. Does it possible to play this audio stream more than 1mn after the lock? Thanks in advance. The code and permission block you have

MediaRecorder.ondataavailable - data size is always 0

泪湿孤枕 提交于 2019-12-01 13:08:50
I'm trying to record a user's voice in the browser using Web API Media Recorder. At this stage, all I'm trying to do with the audio once recorded is add it to the source of an audio element and play it back. When I stop the recorder, the 'ondataavailable' event is triggered, but the size of the data is 0, and nothing can be played back. Here's where my code is at. I'm using React. Any ideas would be very much appreciated! handleRecording (stream) { const recordedChunks = this.state.recordedChunks; const mediaRecorder = new MediaRecorder(stream) const _this = this; mediaRecorder.start();

MediaRecorder.ondataavailable - data size is always 0

做~自己de王妃 提交于 2019-12-01 10:47:50
问题 I'm trying to record a user's voice in the browser using Web API Media Recorder. At this stage, all I'm trying to do with the audio once recorded is add it to the source of an audio element and play it back. When I stop the recorder, the 'ondataavailable' event is triggered, but the size of the data is 0, and nothing can be played back. Here's where my code is at. I'm using React. Any ideas would be very much appreciated! handleRecording (stream) { const recordedChunks = this.state

HTML5 audio won't play on mobile devices

帅比萌擦擦* 提交于 2019-12-01 05:53:46
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 ( YouDon'tSay ) and it works just fine. It should be ok, right? They appear on desktops but they are

Why certain .wav files cannot be decoded in Firefox

陌路散爱 提交于 2019-12-01 05:52:07
I have a web page which decodes wave files for certain reasons. Chrome and Safari seem to work fine. Firefox occasionally is unable to decode the file and gives the error: "The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully." I have created a jsfiddle which illustrates the issue: var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var source; function getData() { source = audioCtx.createBufferSource(); request = new XMLHttpRequest(); request.open('GET', 'https://mpclubtest.s3.amazonaws.com/Malice_Bass.wav', true); request

How to mute/unmute mic in webrtc

依然范特西╮ 提交于 2019-12-01 05:39:37
I have read from here that how i can mute/unmute mic for a localstream in webrtc: WebRTC Tips & Tricks When i start my localstream mic is enable at that time by default so when i set audioTracks[0].enabled=false it muted a mic in my local stream but when i set it back true it enable to unmute. Here is my code mute/unmute for a localstream: getLocalStream(function (stream,enable) { if (stream) { for (var i = 0; i < stream.getTracks().length; i++) { var track = stream.getAudioTracks()[0]; if (track) track.enabled = enable; //track.stop(); } } }); Can someone suggest me how i can unmute mic back

Web Audio API analyser node getByteFrequencyData returning blank array

ぐ巨炮叔叔 提交于 2019-12-01 05:23:50
问题 I'm trying to access FFT data from the analyser node using analyser.getByteFrequencyData(array) but it seems to return a blank array: var array = new Uint8Array(analyser.frequencyBinCount); analyser.getByteFrequencyData(array); However using analyser.getFloatFrequencyData(array) returns an array of data: var array = new Float32Array(analyser.frequencyBinCount); analyser.getFloatFrequencyData(array); I'm using a signal chain as follows: Source -> Analyser -> ScriptProcessor -> Context

Is it possible to detect whether a browser tab is playing audio or not?

元气小坏坏 提交于 2019-12-01 05:00:57
I am looking for a way to detect whether a sound is being played in the current tab of Chrome. I would like to emphasize that the context is a web app and not a chrome extension nor a single audio element . My assumption is that the browser "knows" that the tab is playing sound by displaying an audible icon in the tab header, so I am guessing that there is some kind of browser HTML5 API for that. Roberrrt Simple answer: no Long answer: Some-what-ish would be the best case in this context. Chrome has a dev-only API for it's browser that hooks on audio devices connected, but it's not possible to