Playing music while cordova app is in background (iOS) - ios

I have not found a definite answer to this. This SO article from 2012 does not work anymore.
So far I have included audio in the UIBackgroundModes array in my Info.plist file.
Furthermore I installed the cordova-plugin-media plugin (version 3.0.1). But the music still fades out when I press the home button. What am I missing?

So my problem was, that I didn't see an Info.plist file and simply created my own.
Under cordova the file is called <app_name>-Info.plist and located in the Resources folder. Either way it can also be accessed under the Info tab when selecting the project target.
So after adding audio to UIBackgroundModes to the correct file even the simple HTML5 <audio> tag continues to play in background. Yay!

Related

iOS flutter_local_notifications not making default sound or .caf sound

I am using flutter_local_notifications 9.4.1 in my flutter mobile application
I am deploying successfully to Android and iOS 14.2
My use case is simple - to provide a local notification with a sound when a specific task has completed.
Android - everything works fine - my mp3 sound plays when the notification appears just as I want. Perfect.
iOS - I have everything working except for sound. I have added a custom sound (a CAF file converted from a .AIF file, using the Apple recommended procedure ... afconvert). I added the sound file to the Flutter project the correct way - by using XCode to include it into the top level folder with the target ticked. In my flutter code, I already have the modification to the appDelegate.swift, and in the IOSNotificationDetails I have ensured that presentSound is true and presentAlert is true. I am also specifying sound: 'mysound.caf'. But actually even if I don't specify a custom sound, according to the documentation, the default sound will be used. But no sound occurs, default or otherwise.
On the iPhone device, I have checked silent mode is off, I have checked the app permissions - everything set as it should be - sound is enabled, notifications are enabled. I have even copied the CAF file manually to the iOS device to be sure it plays and that I can hear it! I have no build errors or run-time errors. So I must be missing something.
I don't know of a way to check that the sound file is actually deployed to the device - is this possible?
Is there something in the setup or deployment process I have missed? I have not posted code up because I have spent hours comparing my code to the documentation and finding no differences. I am hoping someone has experienced this and found an undocumented step.

Where is the file saved by Cordova File plugin on iOS

I am writing a PDF file on an iPhone running iOS 11, using Cordova File Plugin (in Ionic). The file is created successfully (e.g. in a location like file:///var/mobile/Containers/Data/Application/CDFC4E19-082F-4878-9168-F4A735CDAFEB/Documents or file:///var/mobile/Containers/Data/Application/DA918690-B345-438A-B26D-2EA21D618341/Library/Cloud), but then I can't find the file on the iPhone. I have tried setting the directory to cordova.file.documentsDirectory as well as cordova.file.syncedDataDirectory. When I run the Files app on the iPhone, it shows no recent documents, nor any documents at all. I can't find the file on the phone to view it outside of my app.
Where do I have to save the file to make it findable outside of the app?
I think I've answered this myself. Viewing a PDF that an app created is just not a thing on iOS, as useful as that may be. You can of course do that on Android, which is far more useful. It appears that to view the PDF, you have to use iTunes on an iMac to download the file from the phone. Jumping through those Apple hoops, which I am slowly becoming accustomed to, I was able to view the file in the cordova.file.documentsDirectory location.

How to export downloaded audio file(from within app folder) to user accessible music folder in IOS

I am using Xamarin to develop an IOS app. Here the user has an option to download audio files to the document folder within the app, and play it later on.
But i would like to provide an option for the user to access it in music folder or somewhere else, so that user does not have to come back to app to listen it.
Like we save images to camera roll, can we save mp3 or any other audio file to default music folder in IOS. Any solution or ideas using xamarin or xcode are welcome.
Note: I already know about File Sharing with itunes, i am looking for something else explained above.
As I know this isn't possible due to the limitations within iOS

Prevent native video player in sencha touch 2

I'm building an app for iOS and android using sencha touch 2.3.1 (using sencha architect 3 as my IDE if that's useful to know) and I want to be able to play video inline, as opposed to an embedded video that opens up the native video player after the user taps on it. A perfect example of the functionality I'm after would be the Vine app (at least for iOS, I haven't looked at it on android), videos simply play right there on the page without the native iOS video player taking over.
I'm aware of the allowsInlineMediaPlayback property of UIWebView, but I have no clue how to set that, or even whether I can, since I'm not building a native app in xcode (in fact I have no experience doing so, this is my first attempt at building any sort of mobile application).
How do you plan to package your application to run on a mobile device? The html/js/css what you are creating needs to be packaged on some way to have a mobile app. You can use sencha cmd for that but phonegap is sort of more popular for that. If you will use phonegap then you can set this in the config.xml. See http://docs.phonegap.com/en/2.2.0/guide_project-settings_ios_index.md.html
I managed to get this working by installing cordova on my machine, then running the
sencha cordova init
command on my sencha project folder. After that I simply made sure allowsInlineMediaPlayback was set in my cordova config and that my video tag/object in Architect had the webkit-playsinline attribute set to "1".
If you're interested I am still able to continue my normal development and build workflow in Architect (Architect is now compatible with Cordova, though make sure you add
{
"path": "cordova.js",
"remote": true
}
to your app.json manually. Note you only need that entry in the js section of your app.json and DO NOT NEED THE ACTUAL CORDOVA.JS FILE TO BE IN YOUR PROJECT FOLDER, Architect will handle this when you run your build command).

Continue Playing Music Whilst Inactive in Titanium Mobile iOS

I have a Titanium Mobile project for iOS devices and would like to make the music continue playing whilst the application is inactive, and if possible whilst the device is locked.
The audio files are within the application only, not in the iTunes library.
You'll have to set the background modes in the .plist file that is generated as part of the XCode project.
See this link
http://www.codeproject.com/Articles/124159/Hour-21-Building-Background-Aware-Applications
and look for the section called Adding the Background Modes Key
Background audio playing must be a fundamentally important part of your app's functionality to use this, otherwise it will be rejected when you apply to submit it to the app store.

Resources