Customizable non-full screen video player in iPhone - iphone

I know that there is an MPMoviePlayerController present in iPhone to play movies from. But it isn't customizable in the real sense. Also, if I wanted to play movies is a non-full screen mode, it isn't possible today.
I wanted to inquire if anyone knows about the future roadmap of iPhone SDK, is there going to be any such customizable video player upcoming?
Also, is it possible to write a new video player from scratch (maybe including the codecs), then in that case which part of the SDK should be referred to and how?
Some help in this area will be really appreciated.
Thanks,
Saurabh

I don't know of anything in the future about a customizable video player. However, if there are just a few videos you want to play in non-fullscreen mode, there is an option. UIImageView supports animation. So, if you can export your videos as images, you can have them display in an UIImageView.
For example,
//load your images here
youImageView.animationImages = [NSArray arrayWithObjects:[UIImage imageNamed:#"1.png"],
[UIImage imageNamed:#"2.png"],
[UIImage imageNamed:#"3.png"],
[UIImage imageNamed:#"4.png"],
[UIImage imageNamed:#"5.png"],
youImageView.animationDuration = 1; //this is the duration of the animation and can be any value
[youImageView startAnimating];

This blog post http://www.nightirion.com/2010/01/scaling-a-movie-on-the-iphone/ mentions a method that will allow you to play non-fullscreen video. However, I'm not sure if this method will be approved by the app store verification process.

Related

Movie file Blur effect

I want to implement blur effect to Video.
To play video, I use MPMoviePlayerViewController.
But, I don't know how to implement blur effect to movie.
I tried to overlay blur image above the movie so implement blur effect, but it isn't possible.
When video play, It should change with real time. I found libraries to implement image blurr effect, but can't find library to apply blur effect to video with realtime.I use mp4 file for blur effect. I tried to use GPUImage framework, but it doesn't run exactly.
How can implement that?
Please help me.
Thanks.
I believe GPUImage from Brad Larson is the best way to achieve.
Following is the excerpt from the github page of GPUImage
//Filtering live video
//To filter live video from an iOS device's camera, you can use code like the following:
GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
GPUImageFilter *customFilter = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:#"CustomShader"];
GPUImageView *filteredVideoView = [[GPUImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, viewWidth, viewHeight)];
// Add the view somewhere so it's visible
[videoCamera addTarget:customFilter];
[customFilter addTarget:filteredVideoView];
[videoCamera startCameraCapture];
Since GPUImage has open-source code, you can open up the GPUImageVideoCamera class and study the portion where it perform the live filtering of video data. Then use Apple's CoreVideo framework to grab the video data of a movie video being played and make this GPUImage portion work for it.
Sometimes, boiler-plate codes are not available, but there's always a way out.. Good luck. :)

Video searching

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

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

What tools and/or libraries should I use to make an animated book

I want to make a book rather like The Pedlar Lady for iPad. Each page has some rich text, and then an animation with sound effects that runs automatically after the user flips to a new page.
I have some idea how I could do that programmatically - Cocos2D is looking pretty useful - but what I don't know is how I could work with my artist. What tools could he use, and what would he deliver so that I can just slot each page's animation in with minimal effort.
Your artist can deliver you assets in the form of pngs, mp3s, and movies that have already been scaled to the target device. You can build the book mostly with Interface Builder. Use AVPlayer to play animations and audio on command. Alternatively (and with more memory use) you can animate images with UIImageView. If you need to move assets around the screen, you can use timers and change the origin of each asset's view.
Edit:
MPMoviePlayer is a simple option. The view can be added more directly, but I have found this to be convenient for layout; After configuring a view in IB:
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:asset.path]];
moviePlayer.moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayerView addSubview:moviePlayer.view];
moviePlayer.view.frame = moviePlayerView.bounds;
Now that Apple is allowing Adobe's Flash -> App maker, you might want to look at that.

Supporting both high-res and low-res images

What is the best pattern for displaying images both on iOS3 and iOS4?
For example, here's code for a custom activity animation:
activityImageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:#"s01"],
[UIImage imageNamed:#"s02"],
[UIImage imageNamed:#"s03"],
[UIImage imageNamed:#"s04"],
[UIImage imageNamed:#"s05"],
nil];
On low-res and high-res devices running iOS4, the images load as expected. On iOS3 the images cannot be found since the .png extension is seen as missing.
What's the right way to deal with this situation? Do I need to throw hacky conditionals throughout my code or is there a cleaner method?
Is something from Matt Gallagher's article a good approach?
http://cocoawithlove.com/2010/07/tips-tricks-for-conditional-ios3-ios32.html
You still get the auto '#2x' loading behavior in iOS4 even if you use the file extension, so [UIImage imageNamed:#"so1.png"] is fine (it will find "so1#2x.png" if you're running on a Retina Display with OS 4) plus it's backwards compatible with 3, where it will always find the low-res version of the file.
See the "Loading Images into Your Application" section here.