Skip to content

Commit

Permalink
提交1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mabeijianxi committed Dec 14, 2016
1 parent ddb3814 commit d8840fc
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 29 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
###使用方法:
######1:添加依赖
```java
compile 'com.mabeijianxi:small-video-record:1.0.7'
compile 'com.mabeijianxi:small-video-record:1.0.8'
```
######2:在manifests里面添加
```java
Expand Down Expand Up @@ -55,6 +55,9 @@ MediaRecorderConfig config = new MediaRecorderConfig.Buidler()
1:编译环境请满足:targetSdkVersion<=22
2:出现 java.lang.UnsatisfiedLinkError错误可以尝试在gradle.properties中添加:android.useDeprecatedNdk=true,然后在主module的build.gradle中配置ndk {abiFilters "armeabi", "armeabi-v7a"}
######更新日志:
2016-12-14:
提交1.0.8,修复部分手机不支持输入帧率问题,彻底修复录制浏览变形

2016-10-26:
提交1.0.7,增强兼容性,防止录制尺寸不支持奔溃

Expand Down
6 changes: 3 additions & 3 deletions SmallVideoLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 8
versionName "1.0.7"
versionCode 9
versionName "1.0.8"
}

buildTypes {
Expand All @@ -23,7 +23,7 @@ android {
userOrg = 'mabeijianxi'//bintray.com用户名
groupId = 'com.mabeijianxi'//jcenter上的路径
artifactId = 'small-video-record'//项目名称
publishVersion = '1.0.7'//版本号
publishVersion = '1.0.8'//版本号
desc = '利用FFmpeg来小视频录制与压缩处理!'//描述,不重要
website = 'https://github.com/mabeijianxi/small-video-record'//网站,不重要
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CheckedTextView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
Expand All @@ -32,6 +33,8 @@
import mabeijianxi.camera.util.StringUtils;
import mabeijianxi.camera.views.ProgressView;

import static mabeijianxi.camera.MediaRecorderBase.SMALL_VIDEO_WIDTH;

/**
* 视频录制
*/
Expand Down Expand Up @@ -164,7 +167,7 @@ private void initData() {
MediaRecorderBase.MAX_FRAME_RATE=mediaRecorderConfig.getMaxFrameRate();
MediaRecorderBase.MIN_FRAME_RATE=mediaRecorderConfig.getMinFrameRate();
MediaRecorderBase.SMALL_VIDEO_HEIGHT=mediaRecorderConfig.getSmallVideoHeight();
MediaRecorderBase.SMALL_VIDEO_WIDTH=mediaRecorderConfig.getSmallVideoWidth();
SMALL_VIDEO_WIDTH=mediaRecorderConfig.getSmallVideoWidth();
MediaRecorderBase.mVideoBitrate=mediaRecorderConfig.getVideoBitrate();
MediaRecorderBase.CAPTURE_THUMBNAILS_TIME=mediaRecorderConfig.getCaptureThumbnailsTime();
MediaRecorderBase.doH264Compress=mediaRecorderConfig.isDoH264Compress();
Expand Down Expand Up @@ -213,19 +216,18 @@ private void loadViews() {

mProgressView.setMaxDuration(RECORD_TIME_MAX);
mProgressView.setMinTime(RECORD_TIME_MIN);
initSurfaceView();
}

/**
* 初始化画布
*/
private void initSurfaceView() {
final int w = DeviceUtils.getScreenWidth(this);
((RelativeLayout.LayoutParams) mBottomLayout.getLayoutParams()).topMargin = (int) (w / (MediaRecorderBase.SMALL_VIDEO_WIDTH / (MediaRecorderBase.SMALL_VIDEO_HEIGHT * 1.0f)));
((RelativeLayout.LayoutParams) mBottomLayout.getLayoutParams()).topMargin = (int) (w / (SMALL_VIDEO_WIDTH / (MediaRecorderBase.SMALL_VIDEO_HEIGHT * 1.0f)));
int width = w;
int height = w * 4 / 3;
int height = (int) (w * ((MediaRecorderBase.mSupportedPreviewWidth*1.0f)/MediaRecorderBase.SMALL_VIDEO_WIDTH));
//
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mSurfaceView
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mSurfaceView
.getLayoutParams();
lp.width = width;
lp.height = height;
Expand All @@ -240,6 +242,8 @@ private void initMediaRecorder() {

mMediaRecorder.setOnErrorListener(this);
mMediaRecorder.setOnEncodeListener(this);
mMediaRecorder.setOnPreparedListener(this);

File f = new File(VCamera.getVideoCachePath());
if (!FileUtils.checkFile(f)) {
f.mkdirs();
Expand Down Expand Up @@ -615,7 +619,7 @@ public void onAudioError(int what, String message) {

@Override
public void onPrepared() {

initSurfaceView();
}

public void onFinished() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public abstract class MediaRecorderBase implements Callback, PreviewCallback, IM
*/
protected static int mVideoBitrate = 2048;

protected int mSupportedPreviewWidth = 0;
public static int mSupportedPreviewWidth = 0;
/**
* 状态标记
*/
Expand Down Expand Up @@ -515,19 +515,23 @@ private boolean isSupported(List<String> list, String key) {
protected void prepareCameraParaments() {
if (mParameters == null)
return;

List<Integer> rates = mParameters.getSupportedPreviewFrameRates();
if (rates != null) {
if (rates.contains(MAX_FRAME_RATE)) {
mFrameRate = MAX_FRAME_RATE;
} else {
boolean findFrame=false;
Collections.sort(rates);
for (int i = rates.size() - 1; i >= 0; i--) {
if (rates.get(i) <= MAX_FRAME_RATE) {
mFrameRate = rates.get(i);
findFrame=true;
break;
}
}
if (!findFrame){
mFrameRate=rates.get(0);
}
}
}

Expand Down
27 changes: 12 additions & 15 deletions SmallVideoLib/src/main/res/layout/activity_media_recorder.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_381902">

<RelativeLayout
Expand All @@ -16,10 +16,10 @@
android:id="@+id/title_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dip"
android:contentDescription="@string/imageview_content_description"
android:padding="10dip"
android:layout_centerVertical="true"
android:src="@drawable/record_cancel_normal" />


Expand Down Expand Up @@ -65,20 +65,16 @@
android:layout_height="5dp"
android:layout_below="@+id/title_layout" />

<RelativeLayout
android:id="@+id/camera_layout"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/record_progress">



<SurfaceView
android:id="@+id/record_preview"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</RelativeLayout>
</FrameLayout>

<!-- camera_bottom_bg -->
<RelativeLayout
Expand All @@ -87,7 +83,8 @@
android:layout_height="match_parent"
android:layout_below="@+id/record_progress"
android:layout_marginTop="300dip"
android:background="@color/color_381902">
android:background="@color/color_381902"
>

<CheckedTextView
android:id="@+id/record_delete"
Expand All @@ -101,14 +98,14 @@

<TextView
android:id="@+id/record_controller"
android:textColor="@color/camera_progress_three"
android:gravity="center"
android:text="按住拍"
android:textSize="16sp"
android:layout_width="108dp"
android:layout_height="108dp"
android:layout_centerInParent="true"
android:background="@drawable/small_video_shoot" />
android:background="@drawable/small_video_shoot"
android:gravity="center"
android:text="按住拍"
android:textColor="@color/camera_progress_three"
android:textSize="16sp" />
</RelativeLayout>


Expand Down
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.mabeijianxi.smallvideo"
minSdkVersion 14
targetSdkVersion 22
versionCode 8
versionName "1.0.7"
versionCode 9
versionName "1.0.8"
}
buildTypes {
release {
Expand Down

0 comments on commit d8840fc

Please sign in to comment.