语音听写

This commit is contained in:
18401019693
2022-10-20 17:49:04 +08:00
parent 3c6b4d13a9
commit f25f61b78c
35 changed files with 503 additions and 78 deletions

View File

@@ -470,6 +470,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
//获取指导员账号
ConversationIMListManager.get(this).getUserInstructor(this);
checkVersion();
// new Handler().postDelayed(new Runnable() {
// @Override
// public void run() {
// startActivity(new Intent(MainActivity.this,TestActivity.class));
// }
// },1000);
}
/**

View File

@@ -1,84 +1,35 @@
package com.yunbao.main.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.text.SpannableStringBuilder;
import android.widget.TextView;
import com.tencent.live2.V2TXLiveDef;
import com.tencent.live2.V2TXLivePlayer;
import com.tencent.live2.V2TXLivePlayerObserver;
import com.tencent.live2.impl.V2TXLivePlayerImpl;
import com.tencent.rtmp.ui.TXCloudVideoView;
import androidx.appcompat.app.AppCompatActivity;
import com.yunbao.common.views.weight.IRecognizedResult;
import com.yunbao.common.views.weight.Recognizer;
import com.yunbao.main.R;
public class TestActivity extends AppCompatActivity {
private TXCloudVideoView mVideoView;
private V2TXLivePlayer mPlayer;
String TAG = "tag";
private TextView contextLayout;
private Recognizer recognizer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
mPlayer = new V2TXLivePlayerImpl(getApplicationContext());
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
mPlayer.setRenderView(mVideoView);
mPlayer.setObserver(new V2TXLivePlayerObserver() {
contextLayout = findViewById(R.id.context_layout);
recognizer = findViewById(R.id.recognizer);
SpannableStringBuilder builder = new SpannableStringBuilder();
recognizer.setCallBack(new IRecognizedResult() {
@Override
public void onError(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
Log.d(TAG, "[Player] onError: player-" + player + " code-" + code + " msg-" + msg + " info-" + extraInfo);
public void onResult(String data) {
builder.append(data);
contextLayout.setText(builder);
}
@Override
public void onVideoPlayStatusUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayStatus status, V2TXLiveDef.V2TXLiveStatusChangeReason reason, Bundle bundle) {
Log.d(TAG, "[Player] onVideoPlayStatusUpdate: player-" + player + ", status-" + status + ", reason-" + reason);
}
@Override
public void onWarning(V2TXLivePlayer v2TXLivePlayer, int i, String s, Bundle bundle) {
Log.d(TAG, "[Player] Override: player-" + v2TXLivePlayer + ", i-" + i + ", s-" + s);
}
@Override
public void onRenderVideoFrame(V2TXLivePlayer player, V2TXLiveDef.V2TXLiveVideoFrame v2TXLiveVideoFrame) {
super.onRenderVideoFrame(player, v2TXLiveVideoFrame);
Log.d(TAG, "[Player] onRenderVideoFrame: player-" + player + ", v2TXLiveVideoFrame-" + v2TXLiveVideoFrame);
}
});
int result = mPlayer.startPlay("http://sylive.shayucm.com/live/31754_1631600921.flv");
Log.d(TAG, "startPlay : " + result);
// if (TextUtils.isEmpty(url)) {
// return;
// }
// int playType = -1;
// if (url.startsWith("rtmp://")) {
// playType = TXLivePlayer.PLAY_TYPE_LIVE_RTMP;
// } else if (url.endsWith(".flv")) {
// playType = TXLivePlayer.PLAY_TYPE_LIVE_FLV;
// } else if (url.endsWith(".m3u8")) {
// playType = TXLivePlayer.PLAY_TYPE_VOD_HLS;
// } else if (url.endsWith(".mp4")) {
// playType = TXLivePlayer.PLAY_TYPE_VOD_MP4;
// }
// if (playType == -1) {
// ToastUtil.show(R.string.live_play_error_2);
// return;
// }
// if (mPlayer != null) {
// int result = mPlayer.startPlay(url);
// if (result == 0) {
// mStarted = true;
// mUrl = url;
// mPlayType = playType;
// }
// }
// L.e(TAG, "play----url--->" + url);
}
}

View File

@@ -1,15 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|left"
android:background="@color/gray3">
android:background="@color/white"
<com.tencent.rtmp.ui.TXCloudVideoView
android:id="@+id/video_view"
android:orientation="vertical">
<TextView
android:id="@+id/context_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"/>
android:layout_height="0dp"
android:layout_weight="1" />
<com.yunbao.common.views.weight.Recognizer
android:id="@+id/recognizer"
android:layout_width="match_parent"
android:layout_height="100dp"
android:gravity="center" />
</LinearLayout>