Video searching - iphone

I'm developing app for IPhones where users clicks button, gets the list of all videos from his IPhone and uploads chosen video to server.
I know how to upload video to server, but I don't know how to implement video searching.
How can I get pathes to all videos (in users IPhone) in Array?
(Currently my IPhone is unavailable for use, so I'd like to know also how to test video search in IPhone Simulator?)
Kind Regards

You need to use the UIImagePickerController component, configuring it to show only videos when browsing the library.
You can do that by setting the mediaTypes property of the picker in this way:
myImagePickerController.mediaTypes =
[[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
Then if you want to test it in the simulator, you need to save some videos on it and you can use the UISaveVideoAtPathToSavedPhotosAlbum function to achieve that. Check out this great answer for more detailed instructions.

This link shows how to access only videos from the photoroll since all videos of the device should be stored there, you should be able to access them from there: Picking video from PhotoLibrary with UIImagePickerController in OS 3.1

Related

iOS 6 in app camera

Im building an app that allows the user to record a video (in app) by pressing a button on the main screen. I don't want the user to be taken to the photo app because the video will only be able to be viewed on the app (Max of 15 seconds) and I can't quite get it. Anyone have the code to do this? A good example of what i want the camera to do is the camera in the app Cinemagram. Thanks for any help.
If you plan on saving the movie to the user's photo library, then you can use UIImagePickerController. In particular, you should read the guide that accompanies the class.
However, if you only want the video to be temporary, then you will probably want to use AVFoundation. You would then need to configure an AVCaptureSession with an AVCaptureMovieFileOutput to write the video to disk. Then, when you are ready to play the video, create an AVURLAsset with the file url that you just wrote, use that to create an AVPlayer to play the video, and add an AVPlayerLayer to your view, with said player, to display the video.
Either way, I would recommend studying the examples that Apple provides.
AVCam and
AVPlayerDemo should be more than enough to get you started (especially the AVCam example project).

how to get iphone ipod playlist images and display it in image view

I am working with iphone ipod to read the album and playlist and play it in my application.
My question is that that i get the image from the album i have selected. and it is also working well in my application.
But i never get images from the playlist which i have selected their are different songs in my playlist and also having different image for that songs. for the album i have get the code and it work great. i am new for this and i cant found any reference code for this.
And i am using AVPlayer to play the songs.
So please help me and provide some sample code. for how to get all images from playlist and convert that image to data in iphone.
Please help me.
You're looking for is the MPMediaItemPropertyArtwork for MPMediaItem. As stated in the docs. After getting the artwork property you can make a MPMediaItemArtwork object, as stated in the docs.
An MPMediaItemArtwork object, or media item artwork, represents a graphical image, such as music album cover art, associated with a media item. Media items are described in MPMediaItem Class Reference.
With this you can do something like this. Assuming song is an MPMediaItem:
UIImage *image = nil;
MPMediaItemArtwork *itemArtwork = [song valueForProperty:
MPMediaItemPropertyArtwork];
if(itemArtwork != nil)
image = [itemArtwork imageWithSize:CGSizeMake(100,100)];
Now you have image containing your MPMediaItem artwork, set it to your image view ([myImageView setImage:image]). Keep in mind, this will only work if artwork IS available.
Hope this helps.
You can use VTM_AViPodReader demo for this.

Path to picture on iphone

I'm not quite new but still have a few noob questions this is one of them.
I need a path to one of the pictures all ready in my camera roll on my test iphone. How do I get/find this, not programmatically. I want to hard code it for testing for file upload so I can trouble shoot.
so
filePath:#"/private/var/mobile/Applications/14C39895-E73B-400F-8158-F1F5047A826C/tmp/upload.jpg"
should be what:
filePath:#"fill in this spot"
You can't access the photos directly (unless your app wrote them to the docs folder to begin with -- in which case you would know the path). You'll need to implement a UIImagePicker to select the photo from your photo album. The UIImagePicker delegate will then have access to the photo where you can do whatever you want with it(including writing a copy of it to documents). After the photos been selected once and written to docs, you could then access it in documents on later executions of the app.
The UIImagePicker delegate should implement:
-(void) imagePickerController:(UIImagePickerController *) picker didFinishPickingMediaWithInfo:(NSDictionary *) info {
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
}
Then you can write the image to your apps docs folder in that delegate method, something like this:
http://blog.objectgraph.com/index.php/2010/04/05/download-an-image-and-save-it-as-png-or-jpeg-in-iphone-sdk/
At that point you could always access the photo in your apps docs folder for upload testing... You probably need to implement a UIImagePicker for your app anyway, so instead of looking for your test photo, it may be easier to just select from photo album using UIImagePicker and upload directly (cutting out the whole writing/reading from docs folder).
Hope that helps!

How can I tweet videos from an iPhone app?

How can I tweet videos from an iPhone app programmatically ?
(the absence of programmatically caused me 3 vote downs :D)
Is there a way I can attach a video to a tweet ? Or should I upload the video somewhere else and just tweet the link ?
Any guidance in this regard is much appreciated. Thanks.
You need to upload the video, then link it in. You can't really 'attach' anything to a tweet.
i have same question, how to attach video to tweetsheet programmatically. only found code for setting tweetsheet text, image, or url link. looks like need to upload the video (eg. to amazon s3), then add video's url to tweetsheet ->
[tweetSheet setInitialText:#"Tweeting from my own app! :)"]
if (self.imageString) {
[tweetSheet addImage:[UIImage imageNamed:self.imageString]];
}
if (self.urlString) {
[tweetSheet addURL:[NSURL URLWithString:self.urlString]];
}
i checked the following tutorials/docs:
raywenderlich tutorial
(http://www.raywenderlich.com/21558/beginning-twitter-tutorial-updated-for-ios-6)
appcoda tutorial
(http://www.appcoda.com/ios-programming-101-integrate-twitter-and-facebook-sharing-in-ios-6/)
apple docs
(https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/SLComposeViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40012205)

Curious to know the trick for live wallpapers on lock screen on iPhone

This application and this application says it displays live wallpapers on lock screen. We have similar requirement.
From reviews came to know that it is playing music in background with silent volume, but it is not relevant to setting wallpapers.
Totally bummer topic for us. Can anyone please suggest some point where to begin.. ?
Referred this and Referred this questions on our forum, but says that it won't be approved by Apple. So how does current application exist on store ?
Note:
Please consider this as genuine programming questions as there is no starting point we can find.
If you play music, you can use MPNowPlayingInfoCenter (Available in iOS 5.0 and later.) to set things like cover art, title and artist on the lock screen. Your code could look like this:
NSMutableDictionary *currentTrackData = [[NSMutableDictionary alloc] init];
[currentTrackData setObject:"Some text" forKey:MPMediaItemPropertyTitle];
MPMediaItemArtwork *mediaItemArtwork =[[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:#"your image path"]];
[currentTrackData setObject:mediaItemArtwork forKey:MPMediaItemPropertyArtwork];
[mediaItemArtwork release];
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = currentTrackData;
Dont forget to import the media player framework:
#import <MediaPlayer/MediaPlayer.h>
The live lockscreen app must be doing it this way (MPNowPlayingInfoCenter) as you cant play music whilst using the app