I am doing a video Library app. I want store 6 videos locally in this app. When user download this app, it already had those 6 videos. Also, those videos might be replaced later by other videos if the app has been updated from server. So where should I put those videos? The sandbox document or other place?
The pre-uploaded videos will always be in your bundle, you have no method to replace it. All the other videos will be in your sandbox as it's the only place you can use.
You can have a look at on-demand-resource introduced in iOS9, which may be what you want.
The Documents folder is indeed the best place to store videos or other files that you want to persist between launches of the application.
Because cellular data can be expensive and to reduce initial download size, I recommend allowing the user to download the video files only after installing your app.
The concept I'm talking about can be seen by looking at this related question (code is in Objective-C, tho).
Related
I'm currently making live/animated wallpapers for Android phones, which is pretty easy with GIF/Mp4 files. But I would also like to make the live wallpapers compatible natively with ios/iPhones. I've seen many tutorials on how to convert a video to a Live photo but they all involve some kind of app you need to install on your IPhone. Issue is, I don't own an iPhone or any iOS device to do that and apparently iOS emulators are not a thing, so my question is :
Is it possible to convert a (mp4) video to an iOs Live photo through a 3rd party ? If so, how would you do it ?
I'm pretty inexperienced with the iOS environnement so thank you for your help !
Well, a live photo is a container that holds both a .jpeg and a H.264-encoded .mov file. More details here.
Do you have an Apple computer to do so, or do you want to create it independently from any apple hardware?
For the first case, there are a bunch of (demo) applications on github you could take a look into.
For the second case, I'm not sure if anything exists.
I am writing a simple recorder application which can record/play audio (via. AVFoundation) and save it locally to the iOS device. I've found several sources de
Initially, I would have liked to send out multiple of these saved audio files via email (MessageUI) such as with this simple example: https://gist.github.com/kellyegan/49e3e11fe68b5e6b5360 - though recently I have felt maybe I should forego this in favor of simply saving to the device and allowing the user to send out the file somehow.
Considering this, I feel it might be best to try to save the audio file to a more user-friendly destination. Is there any way I can save these files locally that might allow the user to 'share' them via iOS (outside of my application)? Maybe even to their iTunes library? This seemed promising: iOS - Save audio files to iTunes music library - but looks like the solution provided is actually for saving images to the 'photo album'
When I print the audio file's URL I get something like
'file:///var/mobile/Containers/Data/Application/AA3E5177-A8C8-4FFA-8EBC-85A2A6844A88/Documents/recording-2017-03-06-12-54.m4a'
I am a serious noob w/ Swift 3 and definitely with AVFoundation - I'd really appreciate any and all help/advice. Thanks in advance!
The URL 'file:///var/mobile/Containers/Data/Application/AA3E5177-A8C8-4FFA-8EBC-85A2A6844A88/Documents/recording-2017-03-06-12-54.m4a' may look elaborate to you, but in fact it is totally "user-friendly". It's a file in the app's Documents folder! Nothing could be simpler than that.
The URL in question would never be seen by the user; in fact, it won't even be the same between runs of your app.
Your app can certainly provide interface for the user to select one or more files, and can make them available for sharing out by means of UIActivityViewController or UIDocumentInteractionController.
You might also want to look into UIDocumentPickerViewController or even https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/FileProvider.html
iOS apps are heavily sandboxed. The app's Documents directory (at the path you posted) is the typical place for files like this. You can enable file sharing from the app in iTunes (on the user's computer) by adding the UIFileSharingEnabled key (Application supports iTunes file sharing) to your Info.plist file.
The typical way to enable sharing within the app is by using UIDocumentInteractionController or UIActivityViewController.
I am fairly new to IOS App Development. I have an app which plays audio and videos that are present in the App Package. Now I want my app to play audios and videos that are outside the App Package altogether i.e. if I uninstall my app the media files should not be deleted.
I have heard that all the apps can access media files that are added through ITunes. So I want to know the path of this folder(Kindly excuse me if you find my terminology vague. As I said I am fairly new to IOS App Development).
You cannot store the files outside app sandbox. Where as we can save image/video files to photos app
using, UIImageWriteToSavedPhotosAlbum/UISaveVideoAtPathToSavedPhotosAlbum
Please check developer documentation
I want to create a small App that just shows WebPage with link, video Playing and PDF Documents. The problem is that I expect the app to open Video, PDFs etc without accessing internet.
So, when I click on video, it should play even without internet.
Is it possible to do this in PhoneGap?
As long as they are in a format that the device can handle in the browser directly, you should be fine. A good way to think of PhoneGap is like an enhanced web browser.
You should be able to put the files into the resources, and PhoneGap should be able to access them completely fine. It essentially works by using the file:/// scheme, so you can probably try making something like you'd want to put on the iPad, and try it on your computer. If it doesn't work on there, it likely won't work on the iPad either.
In terms of video files, you'd probably want to use an .mp4, as these should be natively supported by the iOS WebView.
Now that being said, if you're trying to get your app in to the AppStore, you may want to look into the Apple User Interface guidelines. For example section 12.3 of the App Store Review Guidelines states that apps that are ... a collection of links, may be rejected.
You may also find the iOS Human Interface Guidelines helpful.
Let say I want to create an iOS app that download music files from the internet.
Is it possible then to put this music files on the Music Library so that I can play it?
It's not possible. The only way to add music to your library is through iTunes or through the iTunes Store app. Even if you did find a way, it'd probably be through some private API and you'd probably get rejected on the app store.
As Simon said, you won't get music into the native music library. You could however store the audio files and use the AVFoundation Framework (AVAudioPlayer class) to replay them. You could also possibbly use the AudioToolbox framework. Problem is you would have to implement your own music library and your own playback functionality.
Did I mention you have roughly a 0% chance of this app making it into the app store?
It is clearly possible though...even trivial...
Well, in terms of possibility, it is possible if you jailbreak your device, you'd need 2 tweaks to do it:
"Safari download enabler" or manager: to allow you to download files.
"Bride": allows you to import downloaded or saved mp3 files or mp4 video files to your iOS library.
I've been using it for a while and it works like magic
You can have private API/Library. Though I never tried, but you can.
Here is the another similar post:
Programmatically add content to music library