I only have hours of experience and am trying to implement this:
https://github.com/ZaraclaJ/audio_recorder
I am currently piggybacking of Android Studio's example (increment counter).
However I am having trouble with the following line:
AudioRecorder.start(path: _controller.text, audioOutputFormat: AudioOutputFormat.AAC);
What is "path: _controller.text" supposed to be?
Related
NOTE: Please do not do a knee-jerk close recommendation based on "more code required for a minimal reproducible example" especially if you don't understand the question. If you follow my logic, I think you will see that more code is not required.
I'm doing some platform specific Flutter code where I have a platform method "stopRec" (stop recording) which awaits a byte array from the native host.
On the Dart side, it looks like this:
Uint8List? recordedBytes;
recordedBytes = await platform.invokeMethod('stopRec');
As you can see it's expecting to get a byte array (Dart Uint8List) back.
I've written the Android code and it works -- it tests out fine, the recorded bytes come back through and playback correctly.
This is what the Android (Java) code looks like:
byte[] soundBytes = recorder.getRecordedBytes();
result.success(soundBytes);
I hope you understand why "more code" is not yet necessary in this question.
Continuing, though, on the IOS side, I'm getting the following error when calling the platform method:
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: type
'List<Object?>' is not a subtype of type 'Uint8List?' in type cast
The Dart line where the error occurs is:
recordedBytes = await platform.invokeMethod('stopRec');
So what is happening is that it's not getting a the Dart Uint8List it expects sent back from IOS.
The IOS code looks like this:
var dartCompatibleAudioBytes:[UInt8]?
var audioBytesAsDataFromRecorder: Data?
// ..... platform channel section
case "stopRec":
self?.stopRec()
result(self?.dartCompatibleAudioBytes!) // <---- wrong data type getting sent back here
break
// ..... platform channel section
private func stopRec() {
myRecorder.stopRecording()
audioBytesAsDataFromRecorder = myRecorder.getRecordedAudioFileBytesAsData()
dartCompatibleAudioBytes = [UInt8] (audioBytesAsDataFromRecorder!)
}
I have tested the same IOS implementation code as a stand-alone IOS app that is not connected to Flutter, so I know that at the end of the the stopRec() method, the dartCompatibleAudioBytes variable does contain the expected data which plays back properly.
I hope you can see why "more code" is still not necessary.
The Dart code works
The Android code Works
The Dart code works together with the Android Code
The IOS code works
The IOS code does NOT work together with the Dart code
Using what I've shown, can anyone see immediately why the expected data type is not making its way back through the method channel?
According to the documentation, you should be using FlutterStandardTypedData(bytes: Data) in swift in order for it to be deserialized as Uint8List in dart.
I am facing issue with push notification.
Actually i want to make inline-reply with ionic version 3. we are using phonegap-plugin-push (https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md). in Android it will work perfectly fine. but in iOS it has not giving the example with inline-reply.
I have also see same functionality with native iOS and there it is working fine. we need to set some behaviour property in that. but i can not set those property while defining the categories.
Can you please check how to achieve this things in iOS ?
Let'me know if you need any further information ?
I have tried with phonegap-plugin-push.
I have already asked this question in ionic forum and created issue in phonegap-plugin-push gitHub repository. below are the link for your reference.
https://forum.ionicframework.com/t/can-we-do-quick-reply-or-inline-reply-in-ios-using-push-notification/125347/5
https://github.com/phonegap/phonegap-plugin-push/issues/2823
i think we need to set property in below configuration in ionic
const options: PushOptions = {
android: {
icon: 'icon_small',
clearNotifications: 'false',
forceShow: 'false',
},
ios: {
alert: 'true',
badge: true,
sound: 'false',
categories: {
reminder: {
yes: {
callback: 'confirmReminderCallback',
title: 'CONFIRM',
foreground: false,
destructive: false,
//some where over here need to set the behaviour property
},
no: {
callback: 'declineReminderCallback',
title: 'DECLINE',
foreground: false,
destructive: false
}
}
},
},
windows: {},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push',
},
};
I used to use the userDistanceToManeuverLocation variable from the RouteStepProgress Class but this seems to just return nil recently.
Just in case I was doing something wrong I tried following the MapBox iOS nav tutorial (https://docs.mapbox.com/help/tutorials/ios-navigation-sdk/) but this had the same result.
Going by the MapBox tutorial I would do the following to get the variable:
let navigationViewController = NavigationViewController(for: directionsRoute!)
let distance = navigationViewController.navigationService.routeProgress.currentLegProgress.currentStepProgress.userDistanceToManeuverLocation
I don't seem to see any error messages or other concerns. I would get this variable on every tick of the users location but now just returns nil. Thanks for any help
So after some testing I figured out the issue is to do with the newer versions of MapBox Navigation (SDK MapboxNavigation). Anything from version 0.29.0 onwards causes issues. For now I'm sticking with version 0.28.0 and will have to report this to MapBox
Edit:
It looks like the latest version (MapboxNavigation 0.38.0 at the time of writing this edit) appears to provide a solution. I now use distanceRemaining found in the RouteProgress class which does the same thing.
I'm running into an issue with my swift 2 conversion of an Apple provided example for displaying an AVMutableComposition. This is a really useful project if you're trying to visualize your AVComposition to see what might be going on under the hood.
Update: I added print statements to each function to see the order they are being called, and who is calling them, in comparison to the Obj-C project.
Two Issues that I'm seeing that seem pretty important:
synchronizePlayerWithEditor() is not getting called after buildTransitionComposition(_:andVideoComposition:andAudioMix:)
observeValueForKeyPath(_:...) is NOT being called in the same order as the Obj-C project
Posting the snippet here to get the calling function as it's kind of useful
Obj-C
NSLog(#"%d %s %#", __LINE__, __PRETTY_FUNCTION__, [[NSThread callStackSymbols] objectAtIndex:1]);
Swift
func functionnYouWantToPrintCaller(yourNormalParameters..., function:String = __FUNCTION__){...}
print("\(__LINE__) \(__FUNCTION__) \(function)
Here is Apple's AVCompositionDebugViewer project I'm working from: https://developer.apple.com/library/mac/samplecode/AVCompositionDebugViewer
My github repo:
https://github.com/justinlevi/iOSAVCompositionDebugViewerSwift
I think the issue might be stemming from something in the keyValueObservation code although I'm not entirely sure at this point.
The issue ended up being in SimpleEditor.swiftbuildCompositionObjectsForPlayback` method. There were some global variables that were being defined incorrectly.
Everything seems to be working as expected now.
https://github.com/justinlevi/iOSAVCompositionDebugViewerSwift
NSURLConnection has some missing features (and some small bugs!), so I've been re-implementing it via CFNetwork. I'm aiming for a drop-in replacement - identical input, identical output.
Everything works great, except ... I can't find a way to map from CFNetwork error codes ( http://developer.apple.com/library/ios/#documentation/Networking/Reference/CFNetworkErrors/Reference/reference.html ) to the NSURLError codes ( https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html )
NB: please do not tell me to use ASIHttpRequest, AFNetworking, etc - I love them, I use them frequently, but ... for this specific project it's not possible to use any 3rd party code unless it's provided by Apple.