I'm planning on making a game for the iPhone and want to have the background constantly animated. I figured rather than looping a series of images, I'd play a video. Is it possible for me to play a video (with no controls popping up), and have graphics overtop of it (the actual game)? Or would I just be better off with looping images?
(I figured SO would be a better place to ask this than Game Development)
Yes, using AVFoundation, or even the MPMoviePlayerController with the controls property turned off.
You can have anything you like overlaying the video. The performance for that is much better in iOS4 than earlier OS versions.
You can use MPMoviePlayerController and set the control style to none.
MPMoviePlayerController control style and MPMoviePlayerController control style list
Related
I came across this ans to avoid fullscreen video player in iPhone.Can we use this module to create video player custom controls.
I have using jwplayer and have own custom video controls (fast forward/backward, transcript, slow/fast, volume control, fullscreen).This controls gets hidden in iPhone and native iPhone video player is shown.
Is there any way to avoid this iphone fullscreen and still bring own custom controls.
Can this module be used for jwplayer? to bring own custom video control with jwplayer.
I have not seen that particular library in use with our player, so you're more than able to try it - but I cannot guarantee any success, nor can we provide support for its use.
With that being said, iOS 10 is slated to bring inline video playback to Safari for iPhone and the good news is our player is already set up in the way it needs to take advantage of this. Obviously, iOS 10 is in beta and not final yet so things are subject to change, but this is good news for those customers looking for inline video playback in Safari on iPhone.
We are planning to use After Effects video as our banner / hero image as our animation sequence is a bit complex. However, when we've seen examples of websites using this technique, the iPhone / mobile versions are static.
Is there a way to make the video backgrounds work on iPhone also? What are the possible workarounds?
We're thinking that we can use the full video animation on desktop and then have a shorter GIF version for mobile (it's still animating).
Or are there other ways to achieve this?
There are many ways to achieve the sort of effect you're after.
If a very low frame rate is acceptable, using a GIF or sequence of static images with transitions may be good enough.
If the areas of movement are not huge, you can use spritesheet animation. You might even be able to present video for the whole screen if it isn't too long. You can letterbox the video or present it in low resolution scaled up to reduce the size of the spritesheet needed.
You can use a combination of panning backgrounds and moving sprites to create a dynamic video background. Particle effects, lighting effects, all the things the GPU does in real time games can be applied to make the menu background look like video.
In theory you might be able to port OpenH264 to your target platforms and play video natively, but that's probably beyond the scope of what you want to do.
You can't use HTML5 video for that with mobile Safari as playback of inline video is prohibited on iPhone. You could do it on Chrome for Android but playback would require a valid user interaction to start (touchstrart).
You are left with either JavaScript/CSS animations or like you mentioned animated images. APNG may provide a better alternative that GIF on iOS.
I have seen other solutions but none provide a decent user experience - a static image may not be a bad idea if you do not want to spend too much time on it.
Note: if you are building an App you can play inline video on iPhone. The restriction is only for mobile Safari.
I'm shipping a quicktime .mov video encoded with H.264, low quality. It's about 2 MB small. Not full-screen.
The video must be embedded in a view. Is MPMoviePlayerController state-of-the-art for this purpose, or are there better (easier) options?
It's important that the video plays in the non-fullscreen view, and that playback controls are either overlayd on top of the video or can be customized. I'm not sure if MPMoviePlayerController is good for this.
MPMoviePlayerController and MPMoviePlayerViewController are two classes you can use to play video in iOS SDK.
MPMoviePlayerViewController is supposed to be presented as a modal view controller, so it's not what you're looking for.
MPMoviePlayerController plays the video onto a view (UIView) which you can add in your view hierarchy, which is what you need.
Be aware that on iOS < 3.2, MPMoviePlayerController is fullscreen only (not a problem if you're targeting 3.2 or newer).
Although you can do customizations by adding your own buttons (for play, pause and stop controls), sliders (for volume and seeking) and labels (to display duration and length), Apple encourages the use of standard video controls. The reason is that users are used to the standard UI (which is also pretty advanced, supporting features such as fine scrubbing), plus if Apple ever adds new features to it in future versions of iOS, you won't have to add them yourself in your customized implementation.
MPMoviePlayerController is the most straight forward way to play a video, you can do other things including
Play it on a web view
Use AVFoundation and AVPlayer to play the video
With MPMoviePlayerController the video isnt "embedded" in the view rather another view pops up and plays the video, with AVFoundation and AVPlayer you can actually embed it into your view...check out this stack over flow question which details how to use the AVFoundation to play a video here
I am trying to work with an HTML5 animator on an iPhone app. He proposes that we use HTML5 to implement the animations.
As I have never done this before, is it possible for iOS to work with HTML5? Do I just use UIWebView to render the animations?
Yes, you need to crate an UIWebView, but keep in mind that the iPhone has limited amount of memory an CPU, if the animation will be complex I will render slow.
To render more complex animation I suggest using Quartz 2D
When we call MPMoviePlayerController.play method, the movie player is opened and the video is played in a separate full screen. is it possible to play a video in a custom view, that is I have an image added on a view, when this image is clicked, the image has to be removed and the video has to play there itself as the feature in iPad.
Non-full screen playback of video is possible in iPhone OS 3.2 for iPad.
If you are porting an application that uses the MPMoviePlayerController class of the Media Player framework, you must change your code if you want it to run in iPhone OS 3.2. The old version of this class supports only full-screen playback using a simplified interface. The new version supports both full- and partial-screen playback and offers you more control over various aspects of the playback.
On the full-screen question, see this section of the iPad Programming Guide for further information, and this property of MPMoviePlayerController specifically.
Bear in mind that you can still only play one video at a time, and that this is only currently possible for iPad.
Not using MPMoviePlayerController, no.
You might be able to achieve this using a custom movie player, but I haven't seen one in the wild yet, and I don't know how it would be done.