html5-audio

How to play audio in background with firefox os?

*爱你&永不变心* 提交于 2019-12-19 17:38:23
问题 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

Changing <source> with HTML5 Audio works in Chrome but not Safari

女生的网名这么多〃 提交于 2019-12-19 04:07:53
问题 I'm trying to make an HTML5 audio playlist that will work in each major browser: Chrome,Safari, Firefox, IE9+. However, I can't figure out how to change the sources in a cross browser compatible way. UPDATED For example, changing the <source> tag's src s works in Chrome but not Safari. While @eivers88's solution below using canPlayType works it seems easier to me just to change the <source> tag's src s. Can anyone explain to me why my code directly below works in Chrome but not Safari? JS:

Changing <source> with HTML5 Audio works in Chrome but not Safari

余生颓废 提交于 2019-12-19 04:07:21
问题 I'm trying to make an HTML5 audio playlist that will work in each major browser: Chrome,Safari, Firefox, IE9+. However, I can't figure out how to change the sources in a cross browser compatible way. UPDATED For example, changing the <source> tag's src s works in Chrome but not Safari. While @eivers88's solution below using canPlayType works it seems easier to me just to change the <source> tag's src s. Can anyone explain to me why my code directly below works in Chrome but not Safari? JS:

How to play a sound continuously without break?

扶醉桌前 提交于 2019-12-18 17:13:20
问题 I am trying to play a vehicle driven sound in a browser based game (continuously without break). My .wav file length is 1 second and has same frequency from beginning to end. But sound takes a little break before next iteration. Here is code: function playSound() { //alert(""); myAudio = new Audio('http://ithmbwp.com/feedback/SoundsTest/sounds/tank_driven.wav'); if (typeof myAudio.loop == 'boolean') { myAudio.loop = true; } else { myAudio.addEventListener('ended', function() { this

how to get audio.duration value by a function

混江龙づ霸主 提交于 2019-12-18 15:52:57
问题 Im my audio player I need to get the duration of my audio track. I need a function that gets src of the audio and returns its duration. Here is what I am trying to do but does not work: function getDuration(src){ var audio = new Audio(); audio.src = "./audio/2.mp3"; var due; return getVal(audio); } function getVal(audio){ $(audio).on("loadedmetadata", function(){ var val = audio.duration; console.log(">>>" + val); return val; }); } I tried to split into two functions but it does not work. It

How do you hide HTML5 Audio controls?

旧城冷巷雨未停 提交于 2019-12-18 14:15:11
问题 How can I hide HTML5 audio's browser specific controls? I'm making thumbnail images to represent each track and JavaScript to play/pause. Thanks! HTML: <audio class="thumbnail" id="paparazzi" controls="none"> <source src="song.ogg" type="audio/ogg" /> <source src="../audio/fernando_garibay_paparazzisnlmix.mp3" type="audio/mpeg" /> Your browser does not support HTML5 audio. </audio> 回答1: The controls attribute is a boolean attribute. This means that if it's specified, controls is true and if

HTML5 <audio> tag not working in Android Webview

谁都会走 提交于 2019-12-18 11:42:56
问题 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. 回答1: this is

WebRTC Live Audio Streaming/Broadcast [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 10:24:57
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I'm trying to get my head round WebRTC. I need to be able to capture and stream live audio through a web browser. I'm just having difficulty finding the code examples that I can understand or is up-to-date. If anyone could help me with just first capturing and playing audio in the

How to set the duration of audio

大兔子大兔子 提交于 2019-12-18 09:08:35
问题 I am trying to set the duration of an audio tag using HTML DOM duration property of audio. I have tried the following but it doesn't seem to work: $('audio')[0].duration = 1; I've gone through other answers but I couldn't see any which make use of the duration property. If the duration property is readonly, what other method does it leave me with? 回答1: You cannot change the duration as it is locked to the original data (which cannot be changed via the audio element). You can achieve the

HTML5 audio ended function [duplicate]

落爺英雄遲暮 提交于 2019-12-18 09:04:32
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: HTML5 audio element with dynamic source I'm trying to get the player to reload a new track once the current one ends, but I think I might have done something wrong. This is the player: <audio id="audio" autoplay controls="controls" onclick="start()"> <source src="song.php" type="audio/mpeg" /> </audio> Here's the script: function start(){ var audio = document.getElementById('audio'); audio.play(); audio