Skip to content

Commit

Permalink
Merge pull request #89 from xuxiaowei13/fix/width-height-not-working
Browse files Browse the repository at this point in the history
fix the width and height not working issue
  • Loading branch information
endmr11 committed Jul 11, 2023
2 parents 96e3837 + baa3f44 commit 3c6abb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public class EdScreenRecorderPlugin implements FlutterPlugin, ActivityAware, Met
String videoHash;
long startDate;
long endDate;
int width;
int height;

boolean micPermission = false;
boolean mediaPermission = false;
Expand Down Expand Up @@ -134,7 +136,9 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
fileExtension = call.argument("fileextension");
videoHash = call.argument("videohash");
startDate = call.argument("startdate");
customSettings(videoFrame, videoBitrate, fileOutputFormat, addTimeCode, fileName);
width = call.argument("width");
height = call.argument("height");
customSettings(videoFrame, videoBitrate, fileOutputFormat, addTimeCode, fileName, width, height);
if (dirPathToSave != null) {
setOutputPath(addTimeCode, fileName, dirPathToSave);
}
Expand Down Expand Up @@ -339,13 +343,16 @@ private Boolean startRecordingScreen() {
}

private void customSettings(int videoFrame, int videoBitrate, String fileOutputFormat, boolean addTimeCode,
String fileName) {
String fileName, int width, int height) {
hbRecorder.isAudioEnabled(isAudioEnabled);
hbRecorder.setAudioSource("DEFAULT");
hbRecorder.setVideoEncoder("DEFAULT");
hbRecorder.setVideoFrameRate(videoFrame);
hbRecorder.setVideoBitrate(videoBitrate);
hbRecorder.setOutputFormat(fileOutputFormat);
if (width != 0 && height != 0) {
hbRecorder.setScreenDimensions(height, width);
}
if (dirPathToSave == null) {
hbRecorder.setFileName(generateFileName(fileName, addTimeCode));
}
Expand Down
2 changes: 2 additions & 0 deletions lib/src/ed_screen_recorder/ed_screen_recorder_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class EdScreenRecorder {
"fileextension": fileExtension,
"videohash": videoHash,
"startdate": dateNow,
"width": width ?? 0,
"height": height ?? 0,
});
var formatResponse = RecordOutput.fromJson(json.decode(response));
if (kDebugMode) {
Expand Down

0 comments on commit 3c6abb3

Please sign in to comment.