android錄音時間
❶ android錄制音頻怎樣限制錄音時間
對,目前還沒有辦法獲取到對方的語音信息。
Android本身不提供納塵侍獲取音頻輸出洞吵通道的API。
或許是google按照相關法律所以才沒有提供吧,並不是技術上不兄渣行。
❷ android 獲取音頻時長
android當中獲取姿胡視頻音頻的時長物冊稿,三種。
1:獲取視頻罩孝URI後獲取cursor
2:根據MediaPlayer獲取:
3:採用MediaMetadataRetriever的方式:
❸ 安卓手機錄音鎖屏長什麼樣
是一個類似麥克風的紅色圖形。安卓手機錄音鎖屏的頁面就是這樣的。
❹ 微信錄音功能錄音時間太短在哪裡把錄音調時間長
在與好友聊天框中,【最長可錄制為60秒】
友桐攔ipone手機語音發送失敗,好胡可能與手機的貼膜有關,建議你「按住說話」按 鈕時手指靠方按一點;如果還是無法正常發送,你可以嘗試更換手機貼膜。
想要時間久點可以嘗試微信語音通話
目前iPhone/AndroidQQ4.6及以上、WP8QQ4.3及以上版本支持語音通話功能,無論是工作還是在旅行,隨時與家人或同事發起語音通話。
1、在聯系人界面點擊好友頭像=》進入好友資料卡=》點擊左下角語音通話即可;
2、打開與好友的聊天窗口=》點擊「+」輪肢=》即可選擇發起語音通話。
溫馨提示:非Wifi網路壞境下進行語音通話,每分鍾大概0.5M左右的流量,具體還請以實際使用為准,為了節省您的流量,建議在WiFi網路下使用語音通話功能。
❺ 安卓手機怎麼設置通話錄音
點擊安卓手機的電話圖標,打開撥號界面點擊右下角的三個點的圖標,然後點擊設置,在設置界面,下拉點擊通話自動錄音在通話自動錄音界面,激活話筒自動錄音按鈕。
❻ 如何找到安卓手機的錄音功能
方法:在手機的實用工具中可以找到手機的錄音功能,以華為手機為例說明:
具體步驟如下:
1、在手機找到應用工具文件夾並點擊打開;
注意事項
不同安卓手機的錄音功能可能不在同一位置,部分手機可以在手機設置中打開錄音功能,相對應的錄音本地文件可以在手機存儲位置找到。
❼ Android實現錄音功能
1 Android錄音需要聲明錄音許可權
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
2.錄音文件要寫到文件夾中,創建文件夾,在Application的onCreate方法中創建文件夾
@Override
public void onCreate() {
super.onCreate();
CrashHandler mCrashHandler = CrashHandler.getInstance();
mCrashHandler.init(getApplicationContext(), getClass());
initFile();
}
private void initFile() {
//錄音文件
File audioFile = new File(Constant.UrlAudio);
if (!audioFile.exists()) {
audioFile.mkdirs();
} else if (!audioFile.isDirectory()) {
audioFile.delete();
audioFile.mkdirs();
}
//拍攝圖片文件
File imageFile = new File(Constant.UrlImage);
if (!imageFile.exists()) {
imageFile.mkdirs();
} else if (!imageFile.isDirectory()) {
imageFile.delete();
imageFile.mkdirs();
}
}
Constant.UrlImage是個靜態的文件路徑
//錄音文件
public static String UrlAudio = FileUtil.getSdcardPathOnSys()+"/EhmFile/media/audio/";
3.在activity中開始錄音
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.media.MediaRecorder;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.Locale;
public class Record2Activity extends AppCompatActivity {
// 錄音界面相關
Button btnStart;
Button btnStop;
TextView textTime;
// 錄音功能相關
MediaRecorder mMediaRecorder; // MediaRecorder 實例
boolean isRecording; // 錄音狀態
String fileName; // 錄音文件的名稱
String filePath; // 錄音文件存儲路徑
Thread timeThread; // 記錄錄音時長的線程
int timeCount; // 錄音時長 計數
final int TIME_COUNT = 0x101;
// 錄音文件存放目錄
final String audioSaveDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/audiodemo/";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record2);
btnStart = (Button) findViewById(R.id.btn_start);
btnStop = (Button) findViewById(R.id.btn_stop);
textTime = (TextView) findViewById(R.id.text_time);
btnStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 開始錄音
btnStart.setEnabled(false);
btnStop.setEnabled(true);
startRecord();
isRecording = true;
// 初始化錄音時長記錄
timeThread = new Thread(new Runnable() {
@Override
public void run() {
countTime();
}
});
timeThread.start();
}
});
btnStop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 停止錄音
btnStart.setEnabled(true);
btnStop.setEnabled(false);
stopRecord();
isRecording = false;
}
});
}
// 記錄錄音時長
private void countTime() {
while (isRecording) {
Log.d("mediaRe","正在錄音");
timeCount++;
Message msg = Message.obtain();
msg.what = TIME_COUNT;
msg.obj = timeCount;
myHandler.sendMessage(msg);
try {
timeThread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Log.d("mediaRec", "結束錄音");
timeCount = 0;
Message msg = Message.obtain();
msg.what = TIME_COUNT;
msg.obj = timeCount;
myHandler.sendMessage(msg);
}
/**
* 開始錄音 使用amr格式
* 錄音文件
*
* @return
*/
public void startRecord() {
// 開始錄音
/* ①Initial:實例化MediaRecorder對象 */
if (mMediaRecorder == null)
mMediaRecorder = new MediaRecorder();
try {
/* ②setAudioSource/setVedioSource */
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);// 設置麥克風
/*
* ②設置輸出文件的格式:THREE_GPP/MPEG-4/RAW_AMR/Default THREE_GPP(3gp格式
* ,H263視頻/ARM音頻編碼)、MPEG-4、RAW_AMR(只支持音頻且音頻編碼要求為AMR_NB)
*/
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
/* ②設置音頻文件的編碼:AAC/AMR_NB/AMR_MB/Default 聲音的(波形)的采樣 */
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
fileName = DateFormat.format("yyyyMMdd_HHmmss", Calendar.getInstance(Locale.CHINA)) + ".m4a";
//注意文件夾要創建之後才能使用
filePath = Constant.UrlAudio + fileName;
/* ③准備 */
mMediaRecorder.setOutputFile(filePath);
mMediaRecorder.prepare();
/* ④開始 */
mMediaRecorder.start();
} catch (IllegalStateException e) {
Log.i("mediaEr", "call startAmr(File mRecAudioFile) failed!" + e.getMessage());
} catch (IOException e) {
e.printStackTrace();
Log.i("mediaEr", "call startAmr(File mRecAudioFile) failed!" + e.getMessage());
}
}
/**
* 停止錄音
*/
public void stopRecord() {
//有一些網友反應在5.0以上在調用stop的時候會報錯,翻閱了一下谷歌文檔發現上面確實寫的有可能會報錯的情況,捕獲異常清理一下就行了,感謝大家反饋!
try {
mMediaRecorder.stop();
mMediaRecorder.release();
mMediaRecorder = null;
filePath = "";
} catch (RuntimeException e) {
Log.e("mediaR", e.toString());
mMediaRecorder.reset();
mMediaRecorder.release();
mMediaRecorder = null;
File file = new File(filePath);
if (file.exists())
file.delete();
filePath = "";
}
}
// 格式化 錄音時長為 秒
public static String FormatMiss(int miss) {
return "" + miss;
}
Handler myHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case TIME_COUNT:
int count = (int) msg.obj;
Log.d("meidaRe","count == " + count);
textTime.setText(FormatMiss(count));
break;
}
}
};
@Override
protected void onDestroy() {
super.onDestroy();
myHandler.removeCallbacksAndMessages(null);
}
}
布局文件很簡單
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Record2Activity">
<Button
android:id="@+id/btn_stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="結束"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/btn_start"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btn_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="開始"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btn_stop"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="11dp"
android:layout_marginTop="47dp"
android:text="時間"
app:layout_constraintStart_toStartOf="@+id/btn_start"
app:layout_constraintTop_toBottomOf="@+id/btn_start" />
</androidx.constraintlayout.widget.ConstraintLayout>
這樣就可以使用錄音功能了
❽ Android的MediaRecorder怎麼顯示音頻記錄的時間期限
解決卜困枯方法 :
在記錄開始的 System.currentTimeMillis(); 方法中設置 start_time 方法。
然後使用 Runnable 可型洞以執行一個循環,直到停止記錄。
final Handler handler = new Handler();
Runnable update_runnable = new Runnable() {
public void run() {
updateTextView();
}
};
Then with the updateTextView() you'd do something like this:
long ration = (int) ((System.currentTimeMillis() - start_time) / 1000);
// ... set TextView with ration value
handler.postDelayed(update_runnable, 1000); /尺羨
❾ 安卓手機通話怎麼錄音
若是使用vivo手機,撥打電話時,點擊通話界面的「錄音」即可錄制通話內容。
一、設置通話自動錄音的方法:
1、進入i管家--實用工具--輔助功能--通話錄音--選擇「所有通話自動錄音」或「指定」號碼自動錄音;
2、設置--(應用與許可權--系統應用設置)--電話--通話錄音--選擇「所有通話自動錄音」或「指定號碼自動錄音」,設置後,當開始通話時,手機會自動進行錄音。
❿ android怎麼控制錄音時長
在移動APP開發中,每逢APP應用設猛李計到多媒體開發的時候,都會讓很多的程序員頭疼不已,而且項目的開發進度會放慢、項目
的難度也會悶羨加大蠻多,同時APP的測試也會增加。Android中的多媒體開發,有音頻的播放、音頻的錄制、視頻的播放、視頻的錄制
等,雖然Android的SDK中提供了一些基礎的開發API類,如音頻的錄制就提供了兩種方式:AudioRecord錄制音頻和MediaRecorder錄
制音枝罩遲頻。AudioRecord類相對於MediaRecorder來說,更加接近底層,為我們封裝的方法也更少。然而實現一個AudioRecord的音頻錄
製程序也很簡單。