html5-audio

MVC audio controls playing song from bytes

霸气de小男生 提交于 2019-12-22 04:05:57
问题 I have my songs stored in database as bytes[]. How do I use these in the <audio> tag. So something like this. Do I need to convert the bytes to something else first? I am not sure. foreach (var item in Model) { <audio controls> <source src=@item.SongBytes type="audio/mp3"/> </audio> } 回答1: One way would be to add a new action in your controller that returns the data: public ActionResult Audio(int someId) { byte[] songBytes; // Add code to get data return new FileStreamResult(songBytes, "audio

MVC audio controls playing song from bytes

懵懂的女人 提交于 2019-12-22 04:05:03
问题 I have my songs stored in database as bytes[]. How do I use these in the <audio> tag. So something like this. Do I need to convert the bytes to something else first? I am not sure. foreach (var item in Model) { <audio controls> <source src=@item.SongBytes type="audio/mp3"/> </audio> } 回答1: One way would be to add a new action in your controller that returns the data: public ActionResult Audio(int someId) { byte[] songBytes; // Add code to get data return new FileStreamResult(songBytes, "audio

Convert wav to ogg on app engine (or in javascript?)

99封情书 提交于 2019-12-22 00:25:56
问题 I've built a little app engine app that lets users upload short recordings. Some of the recordings are done in-browser with https://github.com/mattdiamond/Recorderjs, which creates wav files. To save space, I'd like to convert those to ogg before writing them to the app engine datastore, so that I use less of my outgoing bandwidth when I play the audio recordings back to users. How can I do this? I googled around, and apparently there's a command line tool called oggenc that encodes to ogg --

HTML5 audio player with sub-menus

≡放荡痞女 提交于 2019-12-21 23:39:56
问题 I have the following script to play audio files sequence from the selection in menu 1 to the selection in menu 2. It looks like this (a list of Numbers, another for Letters): What I need to do is add two other selection menus, before the action of playing the files, so the selection could be from any menu (even the same one), or other menus (to look like this): So the menu beside the first Select I can choose numbers or letters , and when choosing one them the sub-categories menu beside it

Crossorigin errors when loading VTT file

蓝咒 提交于 2019-12-21 09:16:14
问题 I'm new to using the audio tag in HTML 5 and wanted to build a player. I wanted to test using a VTT file in a track tag to see how closed captioning could work. Here is my code: <audio controls> <source src="myaudio.mp3" type="audio/mpeg"> <track kink="caption" src="myaudio.vtt" srclang="en" label="English"> </audio> According to what I've read, track is supposed to work for both audio and video, which makes sense from an accessibility stand-point. What doesn't make sense is the error I get

Does removing html5 media elements also remove memory used by the video/audio?

为君一笑 提交于 2019-12-21 06:37:17
问题 Does removing an html5 media DOM element (video or audio) also free any memory used by the media represented by that element? (assuming no references in code also) 回答1: From the specification: 4.8.10.16 Best practices for authors using media elements Playing audio and video resources on small devices such as set-top boxes or mobile phones is often constrained by limited hardware resources in the device. For example, a device might only support three simultaneous videos. For this reason, it is

Using <audio> element for playback of raw audio

纵然是瞬间 提交于 2019-12-21 05:14:13
问题 I'm working on a little project that decrypts (using openpgp.js) and decodes a server-side audio file using the Web Audio API. The decrypted file arrives to the client as raw audio. Currently I can play back audio files using source.start(0) but there doesn't seems to be an easy way to dump the audio to a GUI that would allow users to do things like adjust volume and seek through the audio. I have a AudioContext object that's decoded and buffered with createBufferSource function playSound

How to get audio element?

↘锁芯ラ 提交于 2019-12-21 04:51:38
问题 Using React, I wish to get the audio element. var AudioPlayer = React.createClass({ componentDidMount: function () { console.info('Audio: component did mount'); var audio = React.findDOMNode('audio'); console.info('audio', audio); }, render : function() { return ( <audio src="/static/music/foo.mp3" controls /> ); } }); But I keep receiving the error: Error: Invariant Violation: Element appears to be neither ReactComponent nor DOMNode (keys: 0,1,2,3,4) Surely lowered components are React

Play audio using base64 data in html5

瘦欲@ 提交于 2019-12-21 04:51:28
问题 I have created one application to record audio using native mediaPlayer, converting this audio file into base64 data, passing this in html5 audio tag as below, File file = new File(Environment.getExternalStorageDirectory()+"/"+ "audiofile"+"/"+"myAudio.mp3"); byte[] FileBytes =getBytesFromFile(file); String base64 = Base64.encodeToString(FileBytes, Base64.NO_WRAP).toString(); public static byte[] getBytesFromFile(java.io.File file) throws IOException { InputStream is = new FileInputStream

Overlay two audio buffers into one buffer source

ぃ、小莉子 提交于 2019-12-21 04:19:16
问题 Trying to merge two buffers into one; I have been able to create the two buffers from the audio files and load and play them. Now I need to merge the two buffers into one buffer. How can they get merged? context = new webkitAudioContext(); bufferLoader = new BufferLoader( context, [ 'audio1.mp3', 'audio2.mp3', ], finishedLoading ); bufferLoader.load(); function finishedLoading(bufferList) { // Create the two buffer sources and play them both together. var source1 = context.createBufferSource(