iPhone/iPod app that shows text, plays sound and videos - iphone

I want to create an app that shows text, plays sound (mp3 files) and videos (maybe like mp4) on the iPhone/iPod. Sort of like an ebook, but with sound and video players when you click on a play button (plus it should have controls like pause, stop, etc.).
Do you have any suggestions or tips on how I can do this?
I have found individual tutorials on players and all, but not to combine them together or where to start (like what view to use, etc). :(
For example, when opening the app, it shows you something like this:
Yu-Gi-Oh! (遊戯王 Yūgiō?, lit. "Game King" or "King of Games") is a Japanese manga created by Kazuki Takahashi. It has produced a franchise that includes multiple anime shows, a trading card game and numerous video games. Most of the incarnations of the franchise involve the fictional trading card game called Duel Monsters (originally known as Magic & Wizards), where each player uses cards to "duel" each other in a mock battle of fantasy "monsters". The Yu-Gi-Oh! Trading Card Game is the real world counterpart to this fictional game on which it is loosely based.
[video here]
[play | pause | stop]
Yu-Gi-Oh! tells the tale of Yugi, a shorter-than-average high school student who was given the fragmented pieces of an ancient Egyptian artifact, the Millennium Puzzle, by his grandfather. Upon reassembling the Puzzle, he is possessed by another personality who is later revealed to be the spirit of a 3,000-year-old Pharaoh (5,000-years-old in the English anime) called Atem, with no memory of his own time. As the story goes on, the two of them (together with Yugi's friends), try to find the secret of the Pharaoh's lost memories and his name, with the Duel Monsters card game being an ever prevalent backdrop or plot device.
[audio here]
[play | pause | stop]
Something like that.
Thank you for your help!
~kazuo

You go with showing text on iPhone, through pdf,webview or may be textview.Then start working over playing media with AVFoundation ,AudioToolbox frameworks
Then go with playing video with MPMediaPlayer framework.
I have suggested some frameworks which will be used.
Now you can start searching for the implementation and can use that in your app.
Thats the idea...
Now you need to program for that,we are not going to do that for you.
Cheers

Related

Is it possible to record the audio that comes out of the iPhone?

I am working on an app that allows the user to create a sort of dub. There is an audio file playing, and the user can tap at certain moments to insert sound (kind of like a censor button.) I'm wondering how to go about capturing the final product.
Capturing audio directly from the iPhone seems the easiest route, as the user already hears the finished product as it is made. However, I can't find anything on how to do this. If not possible, are there any suggestions?
The best way would probably be to be using the AV Foundation framework for mixing and then buffering the audio as well as playing it. This would allow for a high abstraction level while guaranteeing both played back and saved audio to be equal.
Apart from that: from a How can I achieve this with minimum code-perspective, without more information about your setup, the question is way too broad and/or opinion-based.
You will have to work with buffers. Don't know right now how it is done in Swift but you can implement it in Obj-C and then bridge it out.
You can refer to this answers here in StackOverflow (They are a bit old)
https://stackoverflow.com/a/11218339/2683201
https://stackoverflow.com/a/10101877/2683201
and a project also exists (but is in Obj-C)
https://github.com/alexbw/novocaine
Mainly the idea for your case would be to have 2 separated buffers and your sound effect.
Then, you will be playing from buffer A (your music) and copying played data into buffer B (final Output) unless you are playing the effect. In wich case you will be copying the effect data into your buffer B.
Other option is to do it offline:
Play your music (or audio) and keep a timer running synced with the elapsed time of your "to be censored audio".
Save the timestamp of when you start and end tapping the censor button (for example).
Overlap buffer A with your effect in those recorded (start-end) timestamps.
Save the buffer as a file (or do whatever you need to do with it)
UPDATE:
You should take a look into the Apple implementation of something like this:
https://developer.apple.com/library/ios/samplecode/AVAEMixerSample/Introduction/Intro.html

record video in cocos2d iOS game, low resolution for video and high resolution for normal cases

I am using cocos2d's CCRenderTexture to record video of my game. But if recording video in retina display resolution will cost lot of CPU and memory, so I want to use low resolution for video record but keep retina-resolution for normal game play. is it possible?
I've tried "[[CCDirector sharedDirector] enableRetinaDisplay:NO];" during record video, but it seems not work. the generated output totally wrong.
This is not feasible.
You'd have to render each frame twice, once on the screen, then onto the render texture. A serious drop in framerate is inevitable even if you lower the resolution of the render texture somehow.
The reason is simply that you'll also have to write each render texture as an image to flash memory. This is extremely slow. You'll also end up with a huge amount of data. If each (PNG/JPG) image file ends up being a reasonably small 50 KB then one second of recorded data at 60 fps will consume 3 Megabytes of flash memory. One minute would be around 180 Megabytes.
To record a demo of your game, most games follow the simple principle of recording the user input, and then playing back the user input as if the user had issued these commands. This requires careful planning, no breaking changes when updating the app (or invalidating old demos), and no use of non-deterministic randomizers (ie seeded with time).
If you need to record a demo for making a trailer video, there's plenty of screengrabbing solutions around. Some even specialize in grabbing iPhone video, either from the device (usually requires a source code/library component) or from the Simulator.
You should check out Kamcord SDK for recording game play. Check at http://kamcord.com/
Kamcord has a built-in gameplay video and audio recording technology for iOS. It allows you, the game developer, to capture gameplay videos with an API. Your users can then replay and share these gameplay videos via YouTube, Facebook, Twitter, and email.

Capture video without displaying the actual video feed

So I have an application that can currently capture video with the front facing iphone camera and then do some processing on the video feed real-time. What I'm trying to do, however, is make this process run in the background and put other controls onscreen. So for example, say I'd like to run the camera and process the image feed, but I want the user to see a black screen with some buttons on it. Any ideas on how to do this?
Just so we get terminology right, by "in the background", you mean running the camera capture while your application is in the foreground, but not displaying the actual video feed. This is possible, but I wanted to make clear that if you move your whole application into the background you will not have access to the camera then.
There are a few ways to do this, but the one that I've spent the most time with is grabbing frames of video (or photos) via AV Foundation. Using an AVCaptureDevice and AVCaptureSession, you can grab the frames of video and route them to an encoder for saving to disk or for processing using your own custom code. None of this requires the camera feed to be displayed onscreen, so you can put up whatever interface you like and do this video recording or photo capture without any onscreen indication.
I would caution that you should make it explicit to your users what you are doing, so that you do not run the risk of violating someone's privacy. Apple does not react kindly to those who do this (for good reason).
I encapsulate a lot of this within my open source GPUImage video and photo processing framework, so you could look at the code for the GPUImageVideoCamera class there to see how I configure the capture inputs. I hand the video frames off to OpenGL ES for the application of filters and other processing operations, but you could ignore that portion of it if you just wanted to do your own encoding or processing.
Heres an exemple code from Apple's doc:
http://developer.apple.com/library/ios/#samplecode/PhotoPicker/Introduction/Intro.html
there is also the way to customize the camera interface.

iPhone MPMusicPlayerController playback starting position

I'm using Media Player Framework to access the user's music library on iPhone. I would like to set the playback starting position so that I can start playing a song from 30 second mark, for example.
I have trouble finding out how to do this. The MPMediaPlayerController only offers beginSeekingForward but that's not quite what I'm looking for as it simply accelerates the playback speed.
There is probably something really simple that I'm missing.
MPMusicPlayerController's property currentPlaybackTime is a writeable property, so adjusting the playback starting point can be done with player.currentPlaybackTime = 30.0
You can use player.currentPlaybackTime to set the time, before you start playing and playback will start at your desired point.
UPDATE
2009 me had some real problems. He didn't really understand properties and missed the fact that MPMusicPlayerController.currentPlaybackTime is writable! And he was angry. Angry because iOS3.0 had promised iPod Library "Access" and instead delivered MPMusicPlayerController. He had been hoping for speedy access to the music packet data upon which he would have built many fascinating and magical audio applications. Luckily, iOS4.1's AVAssetReader came along 1 year later and he was finally able to stop hating.
WRONG 2009 ANSWER
Nope, this API is deliberately crippled, which is why you don't see any functions for
opening, or streaming from, the media file.
Your only hope is lowering the volume and calling beginSeekingForward until currentPlaybackTime returns >= 30s.
Enjoy!

Is it possible to play a movie file in a UIView layer?

If yes, what movie format has best performance? And how would a simple setup look like? I have some views, and I want to play a short movie inside a view (not fullscreen). The movie is about 5 seconds long.
Looks like the system frameworks only support playing video full screen with the MPMoviePlayerController. Supported formats are basically flavors of H.264 and MPEG-4; more in the documentation.
Theoretically, you might be able to roll your own decoding and playback code, but I doubt you'd get acceptable performance. (And most of the Open Source media player examples I can think of are GPL. Not that I imagine they'd fare much better.)
If it's only 5 seconds long, you can fake it by playing the audio file in the background, and an animated UIImageView at the same time. Lots of apps do this like the ~50 or so baby sign language ones.