Get path of a PHAsset coming from CameraRoll iOS with react native - ios

I'm building a video app uploader using react-native.
I encounter a problem with file management from cameraroll. I have video inside my camera roll that i want to either play in my app (using rn-video), or upload them.
I tried using react-native-image-crop-picker with Passtrough option that should not compress video, but i feel like it's copying the video from cameraroll of iOS to AppData. So for big video i'm stuck sometime a longtime on "Processing Asset ..." window (see post here).
Now my question is, using react-native-cameraroll, i can fetch directly information about local video, but what i get is a link like this : ph://EA9508C5-6B69-46EC-8980-832774283946/L0/00
Is there a way to transform this link into something like this : 'file:///sdcard/Movies/sintel.mp4' without copying the video entirely into my appData (to avoid long import)
Thanks in advance

After some research, i found that we can use a different path called assets-library in iOS :
assets-library://asset/asset.${'mov'}?id=${appleId}&ext=${'mov'}
If you use this path with appleId being the ph asset identificator (something that look like this : const appleId = 'EFA45A33-818E-4A67-A0D8-50991A9B89FB/L0/001' it will work perfectly.
It will work with react-native-fs //File system for RN for copy/paste video for example

Related

Save video file to device in Flutter

I can not save video file to iOS(to be visible in Photos app).
I have tried some plugins but they only save IMAGE(not video) to Photos.
I have used:
image_picker_saver: 0.3.0
It works fine for saving images(iOS), and rotates image for 90 degrees on Android.
For recording, I'm using image_picker: ^0.6.0+10
Any ideas?
Thanks.
Edit:
In the meantime, we have developed a plugin which supports saving both images and videos to gallery(android)/photos(ios), from Camera or url.
https://pub.dev/packages/gallery_saver
it has methods saveImage and saveVideo that take path or url(String).
Aside from the mentioned gallery_saver gallery_saver. There is another existing package that would do the trick, image_gallery_saver. Check this blog for the complete guide on how to save files to your own Flutter App Folder in Internal Phone Storage on Android and to the Photos Library on iOS Device. See also the package file_saver, which is another pretty decent plugin for saving files with formats like PDF, MP3, MP4, etc.

Save audio file to a user-friendly location swift 3 avfoundation

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.

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

AS3/AIR/IOS recording a video on iphone and save it into native gallery directly WITHOUT native UI

I'm developing an APP on iphone using as3,flash builder.
I'd like to know is this possible to record a video and save it into native gallery directly WITHOUT bump out the camera UI.
1.I've try taking photo and save it directly without showing CameraUI. And it works.
(use it--> cameraRoll.addBitmapData(_video))
*
2.but call the video should use this method -> deviceCameraApp.launch( MediaType.IMAGE );
this is the main reason that app launch the native camera UI I guess.
*
3.I've test an as3 FLVRecorder library build by Joris and work good in MAC.
And I'd like to move it to the APP. But when I done the video record,I can't find my video on gallery maybe because of the video is saved into APP.
(like applicationStorageDirectory)
*
so here is my question:
1.is there other way to record and save video directly into gallery without Native camera UI in AS3?
/
2.if is not,could I done this with FLVRecorder library just change the path?
(I'm looking for something like /private/var/mobile/Media/DCIM)
Thanks for help!

youtube api player not working on iOS?

I'm using the YouTube API in my flex app to play videos and it works fine running on my computer and android, but I'm getting an issue when I try to use it on iOS, I just get a black screen!
Any ideas?
I was curious so did some research.
First, I searched for SWFLoader on iOS and this post came up. I'll quote:
You cannot load SWFS that run ActionScript on IOS
Then I realized from your comment you may be using the Loader class; so I googled Flash Loader on iOS and came across this. To quote:
In an iPhone application, you cannot use the Loader.load() method.
However, you cannot run any ActionScript code in SWF content loaded
with the Loader.load() method. However, you can use assets in the SWF
file (such as movie clips, images, fonts, and sounds in the library).
You can also use the Loader.load() method to load image files.
You may benefit from reading through the actual Adobe docs. Specifically this page which focuses on unsupported APIs. It is the last link where the above quote comes from.
It's true you cannot load and run a SWF and in this case the video is a stream so you there is no media to save. Youtube does have an alternative URL that points to an actual mp4 file which will play on iOS. You can use a VideoDisplay player and that URL to play the video.

Resources