2

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.

openfrog
  • 40,201
  • 65
  • 225
  • 373

2 Answers2

2

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.

ySgPjx
  • 10,165
  • 7
  • 61
  • 78
  • Thank you! Does it present the controls as overlay on top of the video or must I make my view bigger to fit the controls? – openfrog Nov 18 '11 at 19:02
  • Playback controls are displayed on top of the video. You can change the style with the `controlStyle` property. Supported types are embedded and fullscreen (you want to use embedded in your specific case). – ySgPjx Nov 18 '11 at 19:06
1

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

Community
  • 1
  • 1
Daniel
  • 22,363
  • 9
  • 64
  • 71