This commit is contained in:
18142669586
2024-02-23 16:07:50 +08:00
commit a02f7b2e22
5737 changed files with 438436 additions and 0 deletions

59
baidu/build.gradle Normal file
View File

@@ -0,0 +1,59 @@
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a","arm64-v8a"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
api rootProject.ext.dependencies["appcompat-androidx"]
//fastJson解析json
implementation rootProject.ext.dependencies["fastjson"]
//百度语音识别
// compile files('libs/bdasr_3.0.8.2.jar')
}

Binary file not shown.

25
baidu/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/macpro/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yunbao.baidu"
/>

View File

@@ -0,0 +1,120 @@
package com.yunbao.baidu.utils;
import android.content.Context;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
//import com.baidu.speech.EventListener;
//import com.baidu.speech.EventManager;
//import com.baidu.speech.EventManagerFactory;
//import com.baidu.speech.asr.SpeechConstant;
/**
* Created by cxf on 2018/7/28.
* 聊天时候语音识别
*/
public class ImAsrUtil {
//
// private EventManager mManager;
// private EventListener mEventListener;
// private String mJsonString;
// private AsrCallback mCallback;
public ImAsrUtil(Context context) {
// mManager = EventManagerFactory.create(context, "asr");
// mEventListener = new EventListener() {
// @Override
// public void onEvent(String name, String params, byte[] bytes, int offset, int length) {
// switch (name) {
// case SpeechConstant.CALLBACK_EVENT_ASR_READY://引擎准备就绪,可以开始说话
// //L.e(TAG, "引擎准备就绪,可以开始说话------>"+params);
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_BEGIN://检测到说话开始
// //L.e(TAG, "检测到说话开始------>" + params);
//// if(mCallback!=null){
//// mCallback.onSpeakStart();
//// }
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_END://检测到说话结束
// //L.e(TAG, "检测到说话结束------>" + params);
//// if (mCallback != null) {
//// mCallback.onSpeakEnd();
//// }
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_PARTIAL://识别结果类型json
// JSONObject obj = JSON.parseObject(params);
// String result = obj.getJSONArray("results_recognition").getString(0);
// //L.e(TAG, "识别结果------>" + result);
// if (mCallback != null) {
// mCallback.onResult(result);
// }
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_FINISH://识别结束(可能含有错误信息)
// //L.e(TAG, "识别结束------>" + params);
// break;
// case SpeechConstant.CALLBACK_EVENT_ASR_LONG_SPEECH://长语音额外的回调,表示长语音识别结束
// //L.e(TAG, "长语音识别结束------>" + params);
// break;
//
// }
// }
// };
// mManager.registerListener(mEventListener);
// JSONObject params = new JSONObject();
// //DECODER = 0 表示禁用离线功能只使用在线功能DECODER = 2 表示启用离线功能但是SDK强制在线优先。
// params.put(SpeechConstant.DECODER, 0);
// //开启长语音
// params.put(SpeechConstant.VAD_ENDPOINT_TIMEOUT, 0);
// //关闭自动断句
// params.put(SpeechConstant.VAD, SpeechConstant.VAD_TOUCH);
// //在选择PID为长句输入法模式的时候是否禁用标点符号
// params.put(SpeechConstant.DISABLE_PUNCTUATION, true);
// //是否需要语音音量数据回调开启后有CALLBACK_EVENT_ASR_VOLUME事件回调
// params.put(SpeechConstant.ACCEPT_AUDIO_VOLUME, false);
// //是否需要语音音频数据回调开启后有CALLBACK_EVENT_ASR_AUDIO事件
// params.put(SpeechConstant.ACCEPT_AUDIO_DATA, false);
// mJsonString = params.toJSONString();
// }
//
// /**
// * 开始录音
// */
// public void start() {
// if (mManager != null) {
// mManager.send(SpeechConstant.ASR_START, mJsonString, null, 0, 0);
// }
// }
//
// /**
// * 停止录音
// */
// public void stop() {
// if (mManager != null) {
// mManager.send(SpeechConstant.ASR_STOP, null, null, 0, 0);
// mManager.send(SpeechConstant.ASR_CANCEL, "{}", null, 0, 0);
// }
// }
//
//
// public void release() {
// if (mManager != null) {
// mManager.send(SpeechConstant.ASR_CANCEL, "{}", null, 0, 0);
// mManager.unregisterListener(mEventListener);
// }
// mManager=null;
// mCallback=null;
// }
// public interface AsrCallback {
// //void onSpeakStart();
//
// void onResult(String result);
//
// //void onSpeakEnd();
// }
//
// public void setAsrCallback(AsrCallback callback){
// mCallback=callback;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.