corona sdk iphone 4s 5.1.1 no sound - iphone

I don't have sound in apps on iphone 4s 5.1.1
tested my app + 2 (unmodified)examples from sample code
even when i send notifications - i get vibration (if with sound) - without sound i don't get vibration but in both cases sound does not play. not it notification not in app
Help!
I tried using ggmusic and ggsound libs by Glitched Games. Both of witch implement the new audio api.
here is some code so i meet the QUALITY STANDARTS
local supportedAudio = {
["Simulator"] = { extensions = { ".aac", ".aif", ".caf", ".wav", ".mp3", ".ogg" } },
["IOS"] = { extensions = { ".aac", ".aif", ".caf", ".wav", ".mp3" } },
["Android"] = { extensions = { ".wav", ".mp3", ".ogg" } },
}

Ok guyz, the thing is - you should check that switch on the right side that turns off sounds. Your media playback will play via loudspeker, but sounds dont. Turn sounds on and it fixes it.
Lame apple user I am.
Cheers!

Related

Flutter - Stop audio playback from recorded video in the background

Essentially the app is like snapchat. I take pics and reset back to camera mode, the issue comes when I record video and reset, it goes back to camera mode but the audio form the video keeps playing in the background. The functions are somwhat exactly like the camera doc, with a few addition to reset the camera.
I added this:
_reset() {
if (mounted)
setState(() {
if (this._didCapture) {
this._didCapture = false;
this._isRecording = false;
this._isPosting = false;
this._file = File('');
this._fileType = null;
this._captions.clear();
this._textEditingControllers.clear();
this._videoController = null;
this._videoPlayerListener = null;
}
});
}
It works just fine but the audio in the background is still on. Also wondering if the video/picture is saved on the phone, which I don't want to...
i had been looking for a similar answer, but i didn´t find it. You could try to stop it adding this to your function:
this._controller.setVolume(0.0);
that´s what i did in my app

Can't stop audio playback on iOS with Codename One

My Codename One app features audio playback in the background when the user taps the screen. The audio I use is an mp3. Here is how I use the Media playback :
public static void playSound(boolean stop) {
sound.reset(); // The input stream needs to go back to the beginning
Media myClip = MediaManager.createMedia(sound, "audio/mp3", () -> {
// If there is no order to stop playback, we keep playing when it has completed (looping)
playSound(false);
});
if (!stop) {
myClip.play();
} else {
myClip.cleanup();
}
}
So hen the user taps the screen components change and I pass true to playSound method. On Android the current playback stops not on iOS with an iPhone 4.
Please note that when the app gets minimized (center button pressed) the playback stops (even if I don't call cleanup() on the Media which I do on Android to stop the playback when the app is minimized).
How can I stop the playback on iPhone ?
Any help appreciated,
#Shai pointed me to the right direction so here is the code finally used :
Media myClip = null;
public static void playSound(boolean stop) {
sound.reset(); // The input stream needs to go back to the beginning
/**
* If the media is playing we don't create it
* otherwise we would have several media in the wild
* that could not be stopped
*/
if (myClip == null || !myClip.isPlaying()) {
myClip = MediaManager.createMedia(sound, "audio/mp3", () -> {
// If there is no order to stop playback, we keep playing when it has completed (looping)
playSound(false);
});
}
if (!stop) {
myClip.play();
} else {
myClip.cleanup();
}
}

Detect Headphones Unplugged - Monotouch

Is there a way to detect if headphones are unplugged in Monotouch? I am trying to look for the AudioSessionAddPropertyListener method but don't see it. What this method ported over?
Here is Apple's docs: http://developer.apple.com/library/ios/#documentation/AudioToolbox/Reference/AudioSessionServicesReference/Reference/reference.html#//apple_ref/doc/constant_group/Audio_Session_Interruption_States
If anyone wants to see the code for how to do this, you can do the following:
AudioSession.PropertyListener p = delegate(AudioSessionProperty prop, int size, IntPtr data) {
NSDictionary propertyDictionary = new NSDictionary(data);
if (propertyDictionary.ContainsKey(NSObject.FromObject("OutputDeviceDidChange_OldRoute")))
{
string oldRoute = propertyDictionary.ValueForKey(new NSString("OutputDeviceDidChange_OldRoute")).ToString();
if (oldRoute == "Headphone")
{
if (audioPlayer != null)
{
audioPlayer.Pause();
}
}
}
};
AudioSession.AddListener(AudioSessionProperty.AudioRouteChange, p);
Is there a way to detect if headphones are unplugged in Monotouch?
I'm not sure but...
I am trying to look for the AudioSessionAddPropertyListener method but don't see it. What this method ported over?
The native call to AudioSessionAddPropertyListener maps to MonoTouch's AudioSession.AddListener static method.

Flash to iPhone Very Slow Performance

I'm creating an iPhone app in Flash, and I've run into performance problems. I've stripped the entire thing down to a simple example (below). It draws a box to the screen, and uses TouchEvent to track finger gestures. Here's the problem: it is extremely sluggish on the iPhone 3G I am testing on. The box stutters up and down the page.
GPU mode is enabled in the application.xml, and when I set the -renderingdiagnostics flag, the text turns blue (meaning it is being rendered each time, which is correct), but the square stays white. It doesn't turn any of the three colors of diagnostics mode. Here is a screen of that:
http://whit.info/dev/flashapp/screen.jpg
And here is a video of the sluggishness:
http://vimeo.com/25160240
So, given that this is only one cached sprite moving vertically, am I missing something about enabling the GPU or bitmap caching? Or is this as good as it gets on this hardware? Other apps seem to glide brilliantly.
Can anyone assist?
Many thanks!
-Whit
package {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.TouchEvent;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
[SWF(width='320', height='480', backgroundColor='#BACC00', frameRate='60')]
public class Main extends MovieClip{
private var square:Sprite;
private var txt:TextField;
private var startDragY:Number;
private var startObjY:Number;
public function Main(){
Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT;
stage.addEventListener(TouchEvent.TOUCH_BEGIN, beginhandler);
stage.addEventListener(TouchEvent.TOUCH_MOVE, movehandler);
stage.addEventListener(TouchEvent.TOUCH_END, endhandler);
drawBox(0xffffff);
makeOutput();
}
private function beginhandler(evt:TouchEvent): void {
startDragY = evt.stageY;
startObjY = square.y;
}
private function movehandler(evt:TouchEvent): void {
out(String(evt.stageY));
square.y = startObjY - (startDragY - evt.stageY);
}
private function drawBox(fill:Number):void {
square = new Sprite();
square.graphics.beginFill(fill);
square.graphics.drawRect(20,60,40,40);
square.graphics.endFill();
stage.addChild(square);
square.cacheAsBitmap = true;
}
private function makeOutput():void {
txt = new TextField();
stage.addChild(txt);
txt.selectable = false;
txt.autoSize = TextFieldAutoSize.CENTER;
txt.defaultTextFormat = new TextFormat("Arial", 22, 0x000000);
txt.text = "Touch Screen";
txt.x = stage.stageWidth/2 - txt.width/2;
txt.y = stage.stageHeight/2 - txt.height/2;
}
private function out(str:String):void {
txt.text = str;
}
}
}
Also, here are the commands I'm using to compile:
.amxmlc ~/Files/Code/iOS/MyApp/Main.as
.pfi -package -renderingdiagnostics -target ipa-test -provisioning-profile MyApp.mobileprovision -storetype pkcs12 -keystore Certificates.p12 -storepass MyPass MyApp.ipa application.xml Main.swf Default.png icons
Latest Adobe updates are meant for the devices.
Our team was also facing the same problem and kinda solved the problem by updating the products.
We updated to:
Flash professional CS5.5
AIR 2.7
and the performance difference is noticeable.
Which version of the Flash exporter are you using? The CS5.5 update allegedly came with some speed boosts.
Also, the iPhone 3g on iOS 4 is already memory starved and I wouldn't be surprised if you were running out of memory with AIR loaded.
If you want good animation performance on an iPhone 3G (perhaps any iOS device), write your app in Objective C using Apple's provided Xcode tools. The result will run tons faster and eat up far less of your customer's device's battery and memory.

how to run vibrate continuously in iphone?

In my application I'm using following coding pattern to vibrate my iPhone device
Include: AudioToolbox framework
Header File:
#import "AudioToolbox/AudioServices.h"
Code:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
My problem is that when I run my application it gets vibrate but only for second but I want that it will vibrate continuously until I will stop it.
How could it be possible?
Thankfully, it's not possible to change the duration of the vibration. The only way to trigger the vibration is to play the kSystemSoundID_Vibrate as you have. If you really want to though, what you can do is to repeat the vibration indefinitely, resulting in a pulsing vibration effect instead of a long continuous one. To do this, you need to register a callback function that will get called when the vibration sound that you play is complete:
AudioServicesAddSystemSoundCompletion (
kSystemSoundID_Vibrate,
NULL,
NULL,
MyAudioServicesSystemSoundCompletionProc,
NULL
);
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
Then you define your callback function to replay the vibrate sound again:
#pragma mark AudioService callback function prototypes
void MyAudioServicesSystemSoundCompletionProc (
SystemSoundID ssID,
void *clientData
);
#pragma mark AudioService callback function implementation
// Callback that gets called after we finish buzzing, so we
// can buzz a second time.
void MyAudioServicesSystemSoundCompletionProc (
SystemSoundID ssID,
void *clientData
) {
if (iShouldKeepBuzzing) { // Your logic here...
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
} else {
//Unregister, so we don't get called again...
AudioServicesRemoveSystemSoundCompletion(kSystemSoundID_Vibrate);
}
}
There are numerous examples that show how to do this with a private CoreTelephony call: _CTServerConnectionSetVibratorState, but it's really not a sensible course of action since your app will get rejected for abusing the vibrate feature like that. Just don't do it.
Read the Apple Human Interaction Guidelines for iPhone. I believe this is not approved behavior in an app.
iOS 5 has implemented Custom Vibrations mode. So in some cases variable vibration is acceptable. The only thing is unknown what library deals with that (pretty sure not CoreTelephony) and if it is open for developers. So keep on searching.
The above answers are good and you can do it in a simple way also.
You can use the recursive method calls.
func vibrateTheDeviceContinuously() throws {
// Added concurrent queue for next & Vibrate device
DispatchQueue.global(qos: .utility).async {
//Vibrate the device
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
self.incrementalCount += 1
usleep(800000) // if you don't want pause in between, remove this line.
do {
if let isKeepBuzzing = self.iShouldKeepBuzzing , isKeepBuzzing == true {
try self.vibrateTheDeviceContinuously()
}
else {
return
}
} catch {
//Exception handle
print("exception")
}
}
}
To stop the device vibration use the following line.
self.iShouldKeepBuzzing = false
ios swift