We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
您好,我想向您咨询一下,视频录制完成后,如果进行播放视频操作的思路。
我直接在MediaUtils的stopRecordSave方法中声明MediaPlayer并且用来播放之前录制的视频,但是一直不成功,提示状态不对,请问您知道什么方法去解决这个问题吗?
感谢!
The text was updated successfully, but these errors were encountered:
我这里想出了一个解决办法,不知道对不对,效果是有了
在MediaUtil中编写方法
public void stopPreview() { releaseCamera(); }
在VideoRecordActivity的stopView方法,增加initPlayer方法
private void stopView(boolean isSave) { stopAnim(); progressBar.setCancel(true); mProgress = 0; handler.removeMessages(0); btnInfo.setText("双击放大"); if (isSave) { recordLayout.setVisibility(View.GONE); send.startAnim(); // 释放摄像头资源 mediaUtils.stopPreview(); // 播放之前录制的视频 initPlayer(); } }
initPlayer方法
private void initPlayer() { // 必须在surface创建后才能初始化MediaPlayer,否则不会显示图像 mPlayer = new MediaPlayer(); mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mSurfaceHolder = surfaceView.getHolder(); mPlayer.setDisplay(mSurfaceHolder); // 循环播放 mPlayer.setLooping(true); // 设置显示视频显示在SurfaceView上 try { mPlayer.setDataSource(mediaUtils.getTargetFilePath()); mPlayer.prepare(); mPlayer.start(); } catch (Exception e) { e.printStackTrace(); } }
就可以了
Sorry, something went wrong.
No branches or pull requests
您好,我想向您咨询一下,视频录制完成后,如果进行播放视频操作的思路。
我直接在MediaUtils的stopRecordSave方法中声明MediaPlayer并且用来播放之前录制的视频,但是一直不成功,提示状态不对,请问您知道什么方法去解决这个问题吗?
感谢!
The text was updated successfully, but these errors were encountered: