Skip to content

Commit

Permalink
Fix issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
HBiSoft committed Feb 21, 2020
1 parent 2a6a75e commit 321f62c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import android.widget.Toast;

import com.hbisoft.hbrecorder.HBRecorder;
import com.hbisoft.hbrecorder.HBRecorderCodecInfo;
import com.hbisoft.hbrecorder.HBRecorderListener;

import java.io.File;
Expand Down Expand Up @@ -312,6 +313,7 @@ private void customSettings() {
}
}

//NOTE - THIS MIGHT NOT BE SUPPORTED SIZES FOR YOUR DEVICE
//Video Dimensions
String video_resolution = prefs.getString("key_video_resolution",null);
if (video_resolution!=null){
Expand Down
12 changes: 4 additions & 8 deletions hbrecorder/src/main/java/com/hbisoft/hbrecorder/HBRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class HBRecorder implements MyListener {
public HBRecorder(Context context, HBRecorderListener listener) {
this.context = context.getApplicationContext();
this.hbRecorderListener = listener;
getScreenDimensions();
setScreenDensity();
}

/*Set output path*/
Expand Down Expand Up @@ -122,17 +122,13 @@ public void setOutputFormat(String format){
outputFormat = format;
}

/*Get/Set screen dimensions/resolution
* This is use to determine video bitrate
* */
private void getScreenDimensions() {
// Set screen densityDpi
private void setScreenDensity() {
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
mScreenWidth = metrics.widthPixels;
mScreenHeight = metrics.heightPixels;
mScreenDensity = metrics.densityDpi;
}

//Set Custom Dimensions (NOTE - THIS IS NOT IDEAL - It is best to use the devices screen size)
//Set Custom Dimensions (NOTE - YOUR DEVICE MIGHT NOT SUPPORT THE SIZE YOU PASS IT)
public void setScreenDimensions(int heightInPX, int widthInPX){
mScreenHeight = heightInPX;
mScreenWidth = widthInPX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,16 @@ public int onStartCommand(final Intent intent, int flags, int startId) {
String notificationButtonText = intent.getStringExtra("notificationButtonText");
mResultCode = intent.getIntExtra("code", -1);
mResultData = intent.getParcelableExtra("data");
mScreenWidth = intent.getIntExtra("width", 720);
mScreenHeight = intent.getIntExtra("height", 1280);
mScreenWidth = intent.getIntExtra("width", 0);
mScreenHeight = intent.getIntExtra("height", 0);

if (mScreenHeight == 0 || mScreenWidth == 0){
HBRecorderCodecInfo hbRecorderCodecInfo = new HBRecorderCodecInfo();
hbRecorderCodecInfo.setContext(this);
mScreenHeight = hbRecorderCodecInfo.getMaxSupportedHeight();
mScreenWidth = hbRecorderCodecInfo.getMaxSupportedWidth();
}

mScreenDensity = intent.getIntExtra("density", 1);
isVideoHD = intent.getBooleanExtra("quality", true);
isAudioEnabled = intent.getBooleanExtra("audio", true);
Expand Down

0 comments on commit 321f62c

Please sign in to comment.