Android development-control mobile audio
This example uses MediaPlayer to play a piece of music and use AudioManager to control the mobile audio. For more information about AudioManager, see AudioManager for Android development.
Program running:
Instance code:
Package com. jph. audiomanagerdemo; import
Mediarecord can be used for recording in Android, which is easy to operate. However, it is not professional enough to Process audio. If you want to process audio in real time or encapsulate the audio
You can use audiorecord for recording.
Here is a piece of code. Audio Recor
is based on the current time to create a recording file, save to the intended directory, with the Mediarecorder class to start recording.
Start recording public void Start_record () {if (! Environment.getexternalstoragestate (). Equals (Android.os.Environment.MEDIA_MOUNTED)) {show_status ("SD card does not exist, please insert SD card
!");
}
else{try {//Get the current time Cur_date = new Date (System.currenttimemillis ());
Str_file = Formatter.format (cur_date); Crea
Compatible with mainstream hardware devices such as Google, HTC, Xiaomi, Samsung, Huawei, etc.
Enables interoperability between devices such as iOS, Web, PC, and Android
Video session, the front camera is turned on by default;
Can have Java audio and video capture, display driver, compatible with more Android devices;
to achieve
To play an audio file, you can use the built-in Music function to play the audio file) "function of the application-that is, use the built-in or installed music player to play the specified audio file.
This example is relatively simple. The source code is provided below:
Layout file activity_main:
Code File MainActivity:
Package com. mutime
First, Vitamio Introduction
What is 1.1 Vitamio?
Vitamio is the Android platform video audio playback component, supporting the playback of almost format video as well as the mainstream network video streaming (HTTP/RTSP/MMS, etc.), detailed Chinese introduction: here.
Vitamio Official website: http://vitamio.org/
Vitamio Weibo: Http://weibo.com/vitamio
Vplayer Official website: http://vplayer.net
Vit
This is how Android supports video formats:
Android can decode JPG files.
Video encoding and decoding in H.263 format,
Only videos in h264 format can be decoded.
Is the life cycle of the mediarecorder class
A common case of using mediarecorder to record audio works as follows:
Mediarecorder
First, paste the program running result of this article. The above is the playing/stopping audio, and the progress can be adjusted using SeekBar. below is the playing/stopping video, and the progress is also adjusted using SeekBar:
Source code of main. xml:
The sou
Android audio and video goes deep into thirteen OpenSL ES to create a music player, which can pause and adjust the volume (with source code download), androidopensl
Project addressHttps://github.com/979451341/OpenSLAudioOpenSL ES is a public audio API developed based on NDK, that is, the underlying C language. It can be used to achieve standardized, high-performa
If you implement an audio file playback, the simplest way to provide the ability to play audio files in your application is to take advantage of the features of the built-in "music" app-even if you use the system's own or installed music player to play the specified audio file.This example is relatively simple, the fol
: Provides an average change to decode audio and video through the filter chain.Libavdevice: Provides abstract access to capture and replay devices.Libswresample: Implement audio blending and resampling programs.Libswscale: Implements color conversion and scaling programs.2. Environment configurationPaste Jnilibs and CPP from the downloaded project into the main folder of the project you createdI also need
: Provides an average change to decode audio and video through the filter chain.Libavdevice: Provides abstract access to capture and replay devices.Libswresample: Implement audio blending and resampling programs.Libswscale: Implements color conversion and scaling programs.2. Environment configurationPaste Jnilibs and CPP from the downloaded project into the main folder of the project you createdI also need
Given the ability to play an audio file, the simplest way to provide the ability to play audio files in your application is to take advantage of the features of the built-in "music" app-even if you use the system's own or installed music player to play the specified audio file.This example is relatively simple, the fol
Android microphone audio sampling and usage
Some codes of Android phone microphone sampling are found online.
Sample results and functional code of your app:
1. In some apps, You need to obtain and use the audio input of the microphone, for example, a hot skirt;
2. Sampling
browser.2.2. Demonstration steps:2.2.1.2 computers open with Chrome browser Rtcurl2.2.2. Computer A on the page enter the user name: PC1, and then click on the "Start" button, click the Start button, in the Browser dialog box, select Allow to use the camera.2.2.3. Computer B Click on the "Refresh" button, you will see the PC1 just logged in, click on "Call", and in the Browser dialog box select Allow the use of the camera.2.2.4. A little wait, you can succeed.2.3. The following drawingsFigure 1
Android Phone Microphone Sampling Some code is found on the Internet, specifically do not remember.Use the sample result and the function code of your own app:1. In some apps, the audio input of the microphone will need to be used, such as a very hot blown skirt;2. Sampling Thread:public class Microlevelrunnable implements Runnable {Private static final String ta
The Androidvideocache is a video/audio cache library that uses local proxies to enable edge-to-bottom playback, which is very simple to use.Httpproxycacheserver is the main class, is a proxy server, you can configure the number of cache files, the size of the cache file, the directory of cache files and the cache file naming algorithm, the file cache is based on the LRU algorithm, using Builder to configure: // Builder cachedirectory (file file);
This article was reproduced from: http://www.jb51.net/article/82281.htmThis article mainly describes the Android app call Mediarecorder implementation of the recording function instance, Mediarecorder is very powerful, not only can be used to record audio can also record video, the need for friends can refer to the nextMediarecorderAndroid Mediarecorder contains
This article mainly introduces the last encounter of some machines do not see the video problem, the article from the blog Park Rtc.blacker, reproduced please indicate the source.Before doing the video chat app has been running well, a few days ago customer feedback said in Samsung 9100. You can't see your own image on the Android4.0.3.After a search to find the WEBRTC is the bottom of the bug, has been repaired and feedback to the community, the foll
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.