3llomi / irecordview Goto Github PK
View Code? Open in Web Editor NEWA Simple Audio Recorder View with "hold to Record Button" and "Swipe to Cancel " Like WhatsApp
License: MIT License
A Simple Audio Recorder View with "hold to Record Button" and "Swipe to Cancel " Like WhatsApp
License: MIT License
Hi @3llomi ,
I'm getting nil value on Bundle from AudioPlayer.swift file which is on pod. So unable to play the recorded audio file as well as unable to fetch it.
let bundle = Bundle(identifier: "org.cocoapods.iRecordView")
public func playAudioFile(soundType: AudioPlayerSounds) {
let bundle = Bundle(identifier: "org.cocoapods.iRecordView")
guard let url = bundle?.url(forResource: getPathByType(soundType: soundType), withExtension: "wav") else{
print("error getting Sound URL")
return
}
do {
player = try AVAudioPlayer(contentsOf: url)
player.play()
} catch {
print("could not play audio file!")
}
}
I am using version iRecordView (0.1.4)
when i install through pods it will give me below errors.
Property 'recordView' not found on object of type 'RecordButton *'
Property 'delegate' not found on object of type 'RecordView *'
Property 'duration' not found on object of type 'RecordView *'
I'm developing a messenger app in which I'm using https://github.com/3llomi/iRecordView library to record voice messages. Everything works fine in debug mode. But when I release the app to App Store and later use the app after downloading from App Store it does not work.
Expected behaviour is that on pressing the record button it makes sound and starts recording as shown in the demo https://github.com/3llomi/iRecordView
But in release mode (App downloaded from App Store) when I press the button nothing happens. There are no crash reports on App Store Connect. Could someone please help me on how could I get device logs or what the problem could be?
From what I could guess is that RecordViewDelegate methods are not being called
self.recordView.delegate = self
is not working I guess. Any suggestions how this could be resolved?
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'void com.devlomi.record_view.RecordView.onActionDown(com.devlomi.record_view.RecordButton, android.view.MotionEvent)' on a null object reference
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.devlomi.record_view.RecordView.onActionDown(com.devlomi.record_view.RecordButton, android.view.MotionEvent)' on a null object reference
at com.devlomi.record_view.RecordButton.onTouch(RecordButton.java:105)
at android.view.View.dispatchTouchEvent(View.java:10058)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2361)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2361)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2361)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2361)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2361)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2361)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:435)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1836)
at android.app.Activity.dispatchTouchEvent(Activity.java:3063)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:397)
at android.view.View.dispatchPointerEvent(View.java:10298)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4928)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4787)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4293)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4346)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4312)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4459)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4320)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4516)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4293)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4346)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4312)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4320)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4293)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6817)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6791)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6734)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6989)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:328)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
My Code I Used
private void initViewAudio(){
binding.recordButton.setRecordView(binding.recordView);
binding.recordView.setSoundEnabled(true);
binding.recordView.setShimmerEffectEnabled(true);
binding.recordView.setRecordButtonGrowingAnimationEnabled(true);
binding.recordView.setCustomSounds(R.raw.record_start,R.raw.record_finished,R.raw.record_error);
binding.recordButton.setListenForRecord(false);
//ListenForRecord must be false ,otherwise onClick will not be called
binding.recordButton.setOnRecordClickListener(new OnRecordClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(ChatActivity.this, "RECORD BUTTON CLICKED", Toast.LENGTH_SHORT).show();
Log.d("RecordButton","RECORD BUTTON CLICKED");
}
});
binding.recordView.setOnBasketAnimationEndListener(new OnBasketAnimationEnd() {
@Override
public void onAnimationEnd() {
Log.d("RecordView", "Basket Animation Finished");
}
});
binding.recordView.setRecordPermissionHandler(new RecordPermissionHandler() {
@Override
public boolean isPermissionGranted() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return true;
}
boolean recordPermissionAvailable = ContextCompat.checkSelfPermission(ChatActivity.this, Manifest.permission.RECORD_AUDIO) == PERMISSION_GRANTED;
if (recordPermissionAvailable) {
return true;
}
ActivityCompat.
requestPermissions(ChatActivity.this,
new String[]{Manifest.permission.RECORD_AUDIO},
0);
return false;
}
});
binding.recordView.setOnRecordListener(new OnRecordListener() {
@Override
public void onStart() {
//Start Recording..
// Log.d("RecordView", "onStart");
setUpRecording();
try {
recorder.prepare();
} catch (IOException e) {
e.printStackTrace();
}
recorder.start();
binding.cardView.setVisibility(View.INVISIBLE);
binding.recordView.setVisibility(View.VISIBLE);
}
@Override
public void onCancel() {
//On Swipe To Cancel
// Log.d("RecordView", "onCancel");
recorder.reset();
recorder.release();
File file = new File(filename);
if (file.exists())
file.delete();
binding.recordView.setVisibility(View.GONE);
binding.messageLayout.setVisibility(View.VISIBLE);
}
@Override
public void onFinish(long recordTime, boolean limitReached) {
//Stop Recording..
//limitReached to determine if the Record was finished when time limit reached.
// String time = getHumanTimeText(recordTime);
Log.d("RecordView", "onFinish");
recorder.stop();
recorder.release();
// Log.d("RecordTime", time);
binding.recordView.setVisibility(View.GONE);
binding.messageLayout.setVisibility(View.VISIBLE);
}
@Override
public void onLessThanSecond() {
//When the record time is less than One Second
Log.d("RecordView", "onLessThanSecond");
recorder.reset();
recorder.release();
File file = new File(filename);
if (file.exists())
file.delete();
binding.recordView.setVisibility(View.GONE);
binding.messageLayout.setVisibility(View.VISIBLE);
}
});
}
private void setUpRecording(){
MediaRecorder recorder = new MediaRecorder();
recorder.reset();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"MolaChat/Media/Recording");
if (!file.exists())
file.mkdirs();
filename=file.getAbsolutePath() + File.separator + System.currentTimeMillis()+".3gp";
recorder.setOutputFile(filename);
Please If This Is a Bug Please Fix Sir Or Any Mistake In My Code
Tell Me I am new For Coding And Making App Like Whatsapp
line 35 in AudioPlayer.swift
player = try AVAudioPlayer(contentsOf: url)
Is it possible to override which type of gesture required for start recording? Providing this functionality will be helpful.
How can we get the audio recording path
The dustbin animation flickers and is not smooth and sometimes the red mic image upon cancellation blinks on the left side before becoming invisible even after animation ends, also the dustbin image is very pixelated when seen on the phone.
delegate property of record view class is strong it should be weak, I saw this issue was closed but delegate is still strong in latest version, please fix this issue asap
Hi! iRecordView is suitable to be binding to Xamarin.iOS?
Best Regards
In RecordView.swift the delegate for RecordViewDelegate should be set to weak, right?
Can we use this library with Objective-C?
Hey, I got "error getting Sound URL" when I try to record with the demo version or with my version.
Why ? How can I get the soundfile?
Thanks
delegate?.onStart()
its working fine in iOS 13 but crashed on 12.3 when I click on button.
Hi Team!
Is it possible we can update the view like WhatsApp for swipe up to lock?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.