Skip to content
New issue

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

fixed issue 17 #97

Open
wants to merge 116 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
75086e6
Implement pause feature by adding 2 main component:
Apr 28, 2018
bc37781
1-file naming increment issue : fixed.
Apr 28, 2018
0bb7944
delete todos regarding pause/resume feature
Apr 28, 2018
0025136
+ Change package name (com.danielkim -> by.naxa)
naXa777 Aug 18, 2018
3d5eae7
Request app permissions at runtime (on Android 6.0 and higher)
naXa777 Aug 19, 2018
10a191f
Integrate Crashlytics SDK to monitor the app's health
naXa777 Aug 19, 2018
0948810
Fix a crash (due to incorrect permissions check)
naXa777 Aug 19, 2018
e4a72b0
Remove extra padding between cards on Records tab
naXa777 Aug 19, 2018
19a04da
Change directory for storing records + refactoring
naXa777 Aug 19, 2018
f5c3ad5
Show error (in Snackbar) if permission is not granted
naXa777 Aug 20, 2018
c5f5583
Modernization: replace com.melnykov.fab.FloatingActionButton (depreca…
naXa777 Aug 20, 2018
3873a35
Add missing russian translations
naXa777 Aug 20, 2018
0de0d04
+ Verify that external storage is available and show error (if it's not)
naXa777 Aug 20, 2018
4d4ed28
Update strings
naXa777 Aug 20, 2018
797c62c
Update Gradle build plugin to the latest version
naXa777 Aug 20, 2018
a34b3c5
Warn when file operations fail
naXa777 Aug 20, 2018
a8a531a
cleanup
naXa777 Aug 20, 2018
58d6178
Use Android Design Support CoordinatorLayout + AppBarLayout + TabLayo…
naXa777 Aug 21, 2018
b85d2e2
Report recording task status (from Service to Activity) - this commit…
naXa777 Aug 21, 2018
20958ae
Cleanup: minor changes to project hierarchy
naXa777 Aug 21, 2018
3fc9c3b
remove dead code
Aug 21, 2018
1322063
add Toast for resumed status.
Aug 21, 2018
0150800
change mPlayButton to FAB.
Aug 21, 2018
f4d8045
Double tapping on Record button was causing Runtime exception at stop()
naXa777 Aug 22, 2018
493b93f
Declares hardware features that are used by the application
naXa777 Aug 22, 2018
b6d531d
Request audio focus when playing a sound recording
naXa777 Aug 24, 2018
d430d42
Minor changes:
naXa777 Aug 24, 2018
40d7aa6
Respond to headset events: pause playback when headset is unplugged
naXa777 Aug 24, 2018
b61e037
* Fix AppBar layout
naXa777 Aug 26, 2018
791c6f2
* Fix "black hole" bug in Android 4.1 (API 16)
naXa777 Aug 26, 2018
2c8ca10
Add landscape mode
naXa777 Aug 27, 2018
e90a613
Apply Material Design to all components (such as PAUSE button, EditTe…
naXa777 Aug 27, 2018
93f6bad
Refactor > Migrate to AndroidX
naXa777 Aug 27, 2018
aac4b31
Fix layout problems
naXa777 Aug 27, 2018
3fc2639
Fix FileUriExposedException, which occurred when sharing files throug…
naXa777 Aug 27, 2018
fe216d3
Update Open Source Licenses
naXa777 Aug 28, 2018
9d660be
prepare for release - app version 2.0
naXa777 Aug 28, 2018
6461c11
"Rename File" dialog - limit TextInputEditText to single line
naXa777 Aug 28, 2018
7894e2b
Update README.md
naXa777 Aug 28, 2018
7e01bef
Update .gitignore
naXa777 Aug 28, 2018
48aa374
"Rename File" dialog - show soft keyboard automatically
naXa777 Aug 28, 2018
4e5e388
Update README.md
naXa777 Aug 28, 2018
3c8aecb
Fix application crash in case if User starts recording when the micro…
naXa777 Aug 28, 2018
5ebc9c6
* Fix application crash when leaving split-screen mode in Android Nou…
naXa777 Aug 29, 2018
20d674f
Update README.md - Contribution
naXa777 Sep 2, 2018
02bd993
Remove ignored files from VCS
naXa777 Sep 2, 2018
04576fb
Start RecordingService in foreground (show persistent notification du…
naXa777 Sep 4, 2018
2cfdc6c
Fix high quality preference
naXa777 Sep 4, 2018
3378832
Fix #31 - Change time format from mm:ss to hh:mm:ss for long records
naXa777 Sep 4, 2018
697c55c
#30 Move app icons to mipmap- folders
naXa777 Sep 4, 2018
63c9a9e
Integrate with Travis CI
naXa777 Sep 4, 2018
fca6032
Setup Fabric Crashlytics CI friendly
naXa777 Sep 4, 2018
45f644f
remove ignored files from VCS
naXa777 Sep 4, 2018
1a3cfc2
Modify build script to proceed with Lint errors (error is caused by c…
naXa777 Sep 4, 2018
8dd7db5
Configure instrumented tests
naXa777 Sep 5, 2018
f7f3d6b
Embed build status image (badge)
naXa777 Sep 5, 2018
7d2f59e
Update README.md - rearrange badges
naXa777 Sep 5, 2018
c14c0c7
Start emulator before tests in order to fix Travis CI error: no conne…
naXa777 Sep 5, 2018
ddb3ad0
Fix Travis CI error: could not parse .travis.yml (syntax error)
naXa777 Sep 5, 2018
6c7c4a6
Fix Travis CI error: Invalid --abi armeabi-v7a for the selected target
naXa777 Sep 5, 2018
1e0aa20
Fix Travis CI error: Target id is not valid
naXa777 Sep 5, 2018
30428d6
Fix Travis CI error: Invalid --abi armeabi-v7a for the selected targe…
naXa777 Sep 5, 2018
1056828
Fix Travis CI error: remove -no-skin -no-audio + try API level 22 + c…
naXa777 Sep 5, 2018
7839c0e
Increase timeout in order to fix Travis CI error: ShellCommandUnrespo…
naXa777 Sep 5, 2018
3e0ab56
Fix Travis CI error (attempt №10) - copy travis.yml from andstatus/an…
naXa777 Sep 5, 2018
6daac58
Fix Travis CI error (attempt №11): INSTRUMENTATION_FAILED: Unable to …
naXa777 Sep 5, 2018
307b805
Fix Travis CI error (attempt №12): INSTRUMENTATION_FAILED: Unable to …
naXa777 Sep 5, 2018
83b8b31
Enable test coverage for debug build
naXa777 Sep 5, 2018
60ad3de
Update README.md
naXa777 Sep 5, 2018
80598ad
Update Crowdin configuration file
naXa777 Sep 5, 2018
3de6e79
Update README.md
naXa777 Sep 5, 2018
e23b87d
Update README.md
naXa777 Sep 5, 2018
7b54057
Update README.md
naXa777 Sep 5, 2018
624e714
Upload coverage report to Codecov after successful build in Travis CI
naXa777 Sep 6, 2018
d0bdfad
:bug: bugfix: duration is displayed as 00:00
naXa777 Sep 6, 2018
c3b6190
Add LeakCanary - a memory leak detection library
naXa777 Sep 6, 2018
31f1b9d
New Crowdin translations (#34)
naXa777 Sep 7, 2018
c016c86
Update README.md
naXa777 Sep 7, 2018
21dc22b
Update README.md - 2 new badges
naXa777 Sep 7, 2018
b8e5b58
Fix #35 Prevent mis-clicks on buttons
naXa777 Sep 8, 2018
84716a1
Fix #21 Chronometer starts even if recording start failed
naXa777 Sep 8, 2018
5ecb514
#37 fix possible memory leaks
naXa777 Sep 8, 2018
649592f
Enhance crash reports
naXa777 Sep 9, 2018
dcd437e
Fix #5 Activity has leaked ServiceConnection that was originally boun…
naXa777 Sep 9, 2018
590ac3c
update Gradle
naXa777 Sep 26, 2018
1c8c880
:busts_in_silhouette: Contributing guidelines
naXa777 Sep 26, 2018
8ef8adf
try to fix anchor link
naXa777 Sep 26, 2018
58f18e0
Create strings.xml for South Korea
Dec 7, 2018
759170c
Add new options icon to sound file list item
Jantzilla Apr 15, 2019
d44fda9
update Gradle and other dependencies
naXa777 Apr 20, 2019
54ca03f
Change "presentFileOptions()" return value from "false" to "true"
Jantzilla Apr 25, 2019
d85f97d
fix Travis CI pipeline :construction_worker: (#57)
naXa777 Jun 18, 2019
46a125d
*.tmp files are now stored in external cache (#59)
har2008preet Jun 25, 2019
b65a5b6
Added Adaptive Icons
Tgo1014 Oct 4, 2019
06f41e4
Merge pull request #62 from Tgo1014/feature/adaptative-icons
naXa777 Oct 7, 2019
6e19084
Successfully added night mode
Oct 22, 2019
49c7af9
update Gradle wrapper to 5.6.3
naXa777 Oct 31, 2019
ebc2a6d
migrate Fabric Crashlytics to Firebase Crashlytics
naXa777 Oct 31, 2019
90cf343
fix Travis CI pipeline :construction_worker:
naXa777 Oct 31, 2019
f87b092
fix Travis CI pipeline :construction_worker:
naXa777 Oct 31, 2019
40aac82
fix Travis CI pipeline :construction_worker:
naXa777 Oct 31, 2019
ca3e6a3
fix Travis CI pipeline :construction_worker: (again)
naXa777 Oct 31, 2019
a6aa8b5
fix Travis CI pipeline :construction_worker: (again and again)
naXa777 Oct 31, 2019
b63f9ce
Merge pull request #64 from MilindAmrutkar/issue-2
naXa777 Oct 31, 2019
52c4249
Added displaying "No recordings" when record list is empty
msolanik Oct 26, 2019
a36b9f6
Merge remote-tracking branch 'origin/master' into maintenance/migrate…
naXa777 Oct 31, 2019
ee3799d
add missing dependency
naXa777 Oct 31, 2019
2ce25ed
Merge pull request #66 from naXa777/maintenance/migrate-to-firebase
naXa777 Oct 31, 2019
e818e86
downgrade target SDK to P (not ready for Q yet)
naXa777 Oct 31, 2019
ff0022b
Added intent for other apps to use recorder (#63)
aman0408 Oct 31, 2019
375177b
add translations from POEditor:
naXa777 Oct 31, 2019
307b38c
update gradle
hyperov Nov 1, 2019
6f7f7b7
add gradle properties
hyperov Nov 1, 2019
4751f00
manual pull request from youcef934
hyperov Nov 1, 2019
fb02d14
code clean up
hyperov Nov 1, 2019
7c40e3f
lint fixes
hyperov Nov 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .idea/misc.xml

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

5 changes: 1 addition & 4 deletions .idea/vcs.xml

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

41 changes: 18 additions & 23 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
Expand Down Expand Up @@ -62,27 +62,24 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
Expand All @@ -92,29 +89,27 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="jdk" jdkName="Android API 21 Platform (1)" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="floatingactionbutton-1.1.0" level="project" />
<orderEntry type="library" exported="" name="library-1.0.6" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.googlecode.mp4parser:isoparser:1.1.21@jar" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.jpardogo.materialtabstrip:library-1.0.6" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.android.support:recyclerview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.android.support:cardview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.nineoldandroids:library:2.4.0@jar" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.melnykov:floatingactionbutton-1.1.0" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.android.support:appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.android.support:support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="Gradle: com.android.support:support-annotations:21.0.3@jar" level="project" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem like spurious changes?

</component>
</module>
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ dependencies {
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.melnykov:floatingactionbutton:1.1.0'
compile 'com.jpardogo.materialtabstrip:library:1.0.6'
compile 'com.googlecode.mp4parser:isoparser:1.1.21'
}
163 changes: 146 additions & 17 deletions app/src/main/java/com/danielkim/soundrecorder/RecordingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,31 @@
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.MediaRecorder;
import android.os.Binder;
import android.os.Environment;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.widget.Toast;

import com.coremedia.iso.boxes.Container;
import com.danielkim.soundrecorder.activities.MainActivity;
import com.googlecode.mp4parser.FileDataSourceImpl;
import com.googlecode.mp4parser.authoring.Movie;
import com.googlecode.mp4parser.authoring.Track;
import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
import com.googlecode.mp4parser.authoring.tracks.AppendTrack;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
Expand Down Expand Up @@ -47,9 +58,20 @@ public class RecordingService extends Service {
private Timer mTimer = null;
private TimerTask mIncrementTimerTask = null;

private boolean isFilePathTemp = true;
private boolean isPaused;
private int tempFileCount = 0;

private ArrayList<String> filesPaused = new ArrayList<>();
private ArrayList<Long> pauseDurations= new ArrayList<>();

// Binder given to clients
private final IBinder mBinder = new LocalBinder();


@Override
public IBinder onBind(Intent intent) {
return null;
return mBinder;
}

public interface OnTimerChangedListener {
Expand Down Expand Up @@ -77,7 +99,32 @@ public void onDestroy() {
super.onDestroy();
}

public void setFileNameAndPath() {
if (isFilePathTemp) {
mFileName = getString(R.string.default_file_name) + (++tempFileCount )+ "_" + ".tmp";
mFilePath = Environment.getExternalStorageDirectory().getAbsolutePath();
mFilePath += "/SoundRecorder/" + mFileName;
} else {
int count = 0;
File f;

do {
count++;

mFileName =
getString(R.string.default_file_name) + "_" + (mDatabase.getCount() + count) + ".mp4";

mFilePath = Environment.getExternalStorageDirectory().getAbsolutePath();
mFilePath += "/SoundRecorder/" + mFileName;

f = new File(mFilePath);
} while (f.exists() && !f.isDirectory());
}
}

public void startRecording() {
isPaused = false;
isFilePathTemp=true;
setFileNameAndPath();

mRecorder = new MediaRecorder();
Expand All @@ -104,35 +151,50 @@ public void startRecording() {
}
}

public void setFileNameAndPath(){
int count = 0;
File f;

do{
count++;
public void pauseRecording(){
isPaused = true;
mRecorder.stop();
mElapsedMillis = (System.currentTimeMillis() - mStartingTimeMillis);
pauseDurations.add(mElapsedMillis);
Toast.makeText(this, getString(R.string.toast_recording_paused), Toast.LENGTH_LONG).show();

mFileName = getString(R.string.default_file_name)
+ "_" + (mDatabase.getCount() + count) + ".mp4";
mFilePath = Environment.getExternalStorageDirectory().getAbsolutePath();
mFilePath += "/SoundRecorder/" + mFileName;
//remove notification
if (mIncrementTimerTask != null) {
mIncrementTimerTask.cancel();
mIncrementTimerTask = null;
}
filesPaused.add(mFilePath);

f = new File(mFilePath);
}while (f.exists() && !f.isDirectory());
}

public void stopRecording() {
mRecorder.stop();
mElapsedMillis = (System.currentTimeMillis() - mStartingTimeMillis);
if(!isPaused)
filesPaused.add(mFilePath);

isFilePathTemp =false;
setFileNameAndPath();

if (!isPaused) {
mRecorder.stop();
mElapsedMillis = (System.currentTimeMillis() - mStartingTimeMillis);
}
mRecorder.release();
Toast.makeText(this, getString(R.string.toast_recording_finish) + " " + mFilePath, Toast.LENGTH_LONG).show();

isPaused = false;
//remove notification
if (mIncrementTimerTask != null) {
mIncrementTimerTask.cancel();
mIncrementTimerTask = null;
}

mRecorder = null;
if (filesPaused != null && !filesPaused.isEmpty()) {
if (makeSingleFile(filesPaused)) {
for (long duration : pauseDurations)
mElapsedMillis += duration;
}
}

try {
mDatabase.addRecording(mFileName, mFilePath, mElapsedMillis);
Expand All @@ -142,6 +204,60 @@ public void stopRecording() {
}
}

/**
* collect temp generated files because of pause to one target file
* @param filesPaused contains all temp files due to pause
*/
private boolean makeSingleFile(ArrayList<String> filesPaused) {
ArrayList<Track> tracks =new ArrayList<>();
Movie finalMovie =new Movie();
for (String filePath : filesPaused) {
try {
Movie movie = MovieCreator.build(new FileDataSourceImpl(filePath));
List<Track> movieTracks = movie.getTracks();
tracks.addAll(movieTracks);
} catch (IOException e) {
e.printStackTrace();
return false;
}
}

if (tracks.size() > 0) {
try {
finalMovie.addTrack(new AppendTrack(tracks.toArray(new Track[tracks.size()])));
} catch (IOException e) {
e.printStackTrace();
}
}
// try {
// finalMovie.addTrack(new AppendTrack((Track) tracks));
// } catch (IOException e) {
// e.printStackTrace();
// }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove "dead code"

Container mp4file = new DefaultMp4Builder().build(finalMovie);
FileChannel fc = null;
try {
fc = new FileOutputStream(new File(mFilePath)).getChannel();
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
}
try {
mp4file.writeContainer(fc);
fc.close();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}

}

public void resumeRecording(){
isPaused=false;
startRecording();
}

private void startTimer() {
mTimer = new Timer();
mIncrementTimerTask = new TimerTask() {
Expand Down Expand Up @@ -171,4 +287,17 @@ private Notification createNotification() {

return mBuilder.build();
}



/**
* Class used for the client Binder. Because we know this service always
* runs in the same process as its clients, we don't need to deal with IPC.
*/
public class LocalBinder extends Binder {
public RecordingService getService() {
// Return this instance of LocalService so clients can call public methods
return RecordingService.this;
}
}
}
Loading