Flutter sound on ios not working with soundpool package - ios

I am using soundpool to play small mp3 sounds in my app. On android everything works fine. But on ios it just won't work. I don't get any error at all, but it just does not play the sound. Neither in the simulator nor on my real device.
This is my code:
_successSoundId = await rootBundle.load("assets/sounds/success.mp3").then((ByteData soundData) {
return pool.load(soundData);
});
await pool.play(_successSoundId)
pubspec:
dependencies:
soundpool: ^2.3.0
assets:
- assets/sounds/
Do I need some permissions or something? What am I missing here.

Related

iOS: Ionic angular app - capacitor camera crash after taking picture

I'm creating Ionic Angular app and I have some functionality which should allow user to take picture. Android app works completely fine but iOS crashes while taking picture. So to add photo you have to click button in app, then if it is first time you will se permissions modal to accept camera permissions and then prompt is shown with 2 options: take photo or from gallery. I choose to take photo so I'm taking it but after clicking camera button to take photo it just crashes and kills my app.
I have all needed permissions in Info.plists: NSCameraUsageDescription, NSPhotoLibraryUsageDescription, NSPhotoLibraryAddUsageDescription
This is how code looks like:
handleAddPhoto = async () => {
if (this.canAddPhoto()) {
const image = await Camera.getPhoto({
quality: 30,
allowEditing: false,
saveToGallery: false,
resultType: CameraResultType.Base64,
source: CameraSource.Prompt,
presentationStyle: 'popover',
});
this.addedImages.find(el => el.src === null).src = this.sanitizeSrc(image.base64String);
this.handleSavePhoto(['data:image/jpeg;base64,' + image.base64String]);
}
};
Capacitor doctor:
Latest Dependencies:
#capacitor/cli: 4.6.1
#capacitor/core: 4.6.1
#capacitor/android: 4.6.1
#capacitor/ios: 4.6.1
Installed Dependencies:
#capacitor/cli: 4.6.1
#capacitor/core: 4.6.1
#capacitor/ios: 4.6.1
#capacitor/android: 4.6.1
[success] iOS looking great! 👌
Capacitor camera version:
"#capacitor/camera": "^4.1.4"
When I have app opened on my phone with Xcode then after taking picture my Xcode shows me this:
I was looking everywhere to find any help with my problem but none of found solutions works for me.
So after some debugging in native code I found it. We use UXCam in our app and it was making mess with camera. As I found some logs it looks like UXCam wanted to record screen during returning from camera view to app view and it was making mess. I didn't find option to repair it because we don't need UXCam that much, so disabling UXCam fixed all issues.

open camera in webview (ios 14, ionic)

I am developing an application with ionic, I want to open the camera to run a tensorlfowjs model.
Ionic packages html and javascript files in a native application and executes them in a webview, with the web version and the android version I have no problems.
But in the version for ios it is giving me a lot of problems opening the camera from the webview.
let video: HTMLVideoElement = document.getElementById("vid") as HTMLVideoElement;
var mediaDevices = navigator.mediaDevices;
mediaDevices
.getUserMedia({
video: true,
audio: true,
})
.then((stream) => {
// Changing the source of video to current stream.
video.srcObject = stream;
video.addEventListener("loadedmetadata", () => {
video.play();
});
})
.catch(error=>console.error('error open camera', error));
I have added the permissions for the camera in info.plist, when I run that code it shows a alert requesting permission for the camera the first time, but I always get an empty error message in the js code
[error] - error open camera {}
I am testing with a device with IOS: 14.4.2 this https://pastebin.com/Dx44XMYY is the system log. where you can see the following message
pp UserMediaPermissionRequestManagerProxy::denyRequest(F6CC2F45DD55FA12) 15, reason: InvalidConstraint
I do not know how to move forward, what to try, or what the reason for the error may be.
I appreciate any advice
Edit: As #jcesarmobile says, it seems to be ios 14 problem, I have tested the code with ios 15 and it works. I appreciate any advice on how to fix it
Since you are setting audio to true, you also need the microphone usage description
NSMicrophoneUsageDescription

iOS Simulator crashes on microphone permission request

My environment:
permission_handler 3.0.0
Flutter v1.2.1
OSX High Sierra 10.13.6
Xcode version 10.1.
My app is crashing when I request the permission for microphone in the iOS simulator.
PermissionStatus mic = await PermissionHandler()
.checkPermissionStatus(PermissionGroup.microphone);
print('microphone permission? ${mic.toString()}');
try {
if (mic != PermissionStatus.granted) {
await PermissionHandler().requestPermissions([PermissionGroup.microphone]);
}
} catch (e) {
print(e);
}
No error is thrown or caught, but in the flutter debug console, I see:
flutter: microphone permission? PermissionStatus.unknown
Lost connection to device.
This means that checkPermissionStatus() returned unknown. But then when I request the permission, the application crashes. I have not been able to try this on a real iPhone. Everything works perfectly on the Android simulator.
I've seen there were some problems in Xcode 10.1 with the microphone:
iOS Simulator would like to access microphone every time
Repeated request for microphone permission on iOS Simulator
What I've tried
Fresh build with flutter clean
Changing the simulator microphone input in Hardware > Audio Input
I could try to upgrade to Xcode 10.2, but I'd need to get mojave first. Trying to avoid that if possible as it might not even fix the issue. I can also try using a real iPhone device instead of the simulator. Would love to get the simulator not crashing, though.
Is anyone able to grant microphone permission in Xcode 10.1/10.2 simulator using permission_handler: 3.0.0? What about another flutter permission plugin?
Please make sure you have added the correct entries to the Info.plist file (for Flutter projects this file is located in the ios/Runner/ folder).
To access the microphone you will need to add the following lines in between the <dict> tags:
<key>NSMicrophoneUsageDescription</key>
<string>this application needs access to the microphone</string>
More information can be found here.
And a complete example of an Info.plist can be found here.

iOS WebRTC and QuaggaJS

I am working on an cordova Barcode Scanner app for mobile Devices. I am using the Framework QuaggaJS for Barcodescanning and the cordova-plugin-ioswebrtc to implement the webrtc functions to cordova. Its working fine on Android Devices and on local Web Browsers on PC, but if i want to use it on iOS I always getting the error "Failed to load ressource: file is directory".
I am initializing Quagga with the following settings:
{decoder:{readers:["code_93_reader"]},
numberOfWorkers: 4,
inputStream:
{
name: "Live",
type: "Livestream",
target: document.querySelector('#scanner'),
constraints:
{
width:{min:640},
height:{min:480},
facingMode: "environment"
}
}
}
The error Message does not describe where the error comes from so I am not sure if its a problem of quaggaJS or of the iOS WebRTC plugin of cordova. Does anyone has build a cordova app with QuaggaJS and can help me where these problem comes from?
If I am Running the getUserMedia Function in the console, i get to different Objects back. In normal iOS Browser the result is of type MediaStream and in the cordova app the result is of type Blob. In safari my app is working without problems, and the Blob Object has all attributes of MediaStream and more so that should not be a problem or?

Issue to open IOS app using costum URL scheme IONIC

I am getting some issue in this Cordova plugin. I do not know where I am doing wrong.
I am not able to call my app in IOS. Android is working fine.
I register my app with mytest://
So my issue is:-
$scope.appOpen = function(){
$scope.finalData.TrustedToken=md5.createHash($scope.finalData.agentid+$sco pe.finalData.Caller+$scope.finalData.key);
var data = JSON.stringify($scope.finalData);
window.open('mytest://'+data, '_system');
}
that code is working fine in Android but in IOS not working.
If I append simple string that is opening my app and also getting that URL there in handler. But above code not able to open other app
window.open('mytest://testData', '_system');
but that code is working fine. so how can i put variable in URL.

Resources