Comments (1)
我这里想出了一个解决办法,不知道对不对,效果是有了
在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();
}
}
就可以了
from mediautils.
Related Issues (20)
- Android7.0及以上的系统调用前置摄像头问题 HOT 2
- 小米4无法录制视频(权限都已给) HOT 2
- 小米6 Android7.0无法录制视频 长按无反应 HOT 1
- S6e S7e切换前置摄像头闪退
- 录制的视频播放时有很大的噪音 HOT 1
- 点击录制和结束时有滴一声。静音状态下也是这样 HOT 2
- 各种奔溃啊
- 解决切换前置系统奔溃,报setParameters错误
- Video Bug
- 项目不错,怎么不更新了呢?
- 找不到录制时间的设置... HOT 1
- 小米手机无法录制 HOT 1
- vivo录制视频时拉伸?
- 录制的视频在PC播放会90度反转吗?
- 小米8 录制时会有滴的一声,每次开始录制都会有提示音 HOT 1
- 您好,楼主问一下,有时候视频预览的时候好像没有显示图像,这个有遇到过么?
- VOIP call recording not working
- camera.unlock
- 录制没反应
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mediautils.