我从 URL 在 videoview 中播放视频......一切正常,甚至视频播放
但唯一的问题是视频需要将近 10 秒才能开始播放,这对用户来说可能有点烦人
我尝试了不同的 URL 并且相同,视频是 360p 和 6 秒长
是不是默认的媒体播放器很慢?
我有堆栈溢出但找不到合适的答案并且曾经搜索过各种 3 rd 方视频库但找不到一个
甚至尝试过谷歌的 exoplayer 库,但在我看来文档并不是那么好
有什么解决方案可以克服这个问题吗?
我的代码
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String videeourl = "http://techslides.com/demos/sample-videos/small.3gp";
VideoView videoView = (FastVideoView)findViewById(R.id.video);
videoView.setMediaController(new MediaController(this));
videoView.setVideoPath(videeourl);
videoView.start();
}
}
Run Code Online (Sandbox Code Playgroud) 我想在我的应用程序中将语音转换为文本..为此,我正在使用识别监听器界面一切正常,但如何在说话时更新和显示文本(就像在谷歌现在的语音搜索中一样)
我已经将 RecognizerIntent.EXTRA_PARTIAL_RESULTS 设置为 true 并且还使用了 RecognizerIntent.EXTRA_PARTIAL_RESULTS 的 onPartialResults(Bundle arg() 方法来设置文本,在语音识别完成后立即显示整个文本但我想要实时文本在用户说话时显示
我的活动
public class MainActivity extends Activity implements RecognitionListener
{
private TextView returnedText;
private ToggleButton toggleButton;
private ProgressBar progressBar;
private SpeechRecognizer speech = null;
private Intent recognizerIntent;
private String LOG_TAG = "VoiceRecognitionActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
returnedText = (TextView) findViewById(R.id.textView1);
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
toggleButton = (ToggleButton) findViewById(R.id.toggleButton1);
Button recordbtn = (Button) findViewById(R.id.mainButton);
progressBar.setVisibility(View.INVISIBLE);
speech = SpeechRecognizer.createSpeechRecognizer(this);
speech.setRecognitionListener(this);
recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE,
"en");
recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
this.getPackageName()); …Run Code Online (Sandbox Code Playgroud)