You can use MPMoviePlayerController to play local video files
1. Add the Mediaplayer framework and #import <MediaPlayer/MediaPlayer.h> in Viewcontroller
2. Drag the video file to Xcode
3. Get the path where the file is stored
Nsstring*thepath=[[nsbundle Mainbundle] pathforresource:@ "Yourvideo" oftype:@ "MOV"]; Nsurl*theurl=[nsurl Fileurlwithpath:thepath];
4. Initialize the MoviePlayer with this path
Self.movieplayer=[[mpmovieplayercontroller alloc] Initwithcontenturl:theurl]; [Self.moviePlayer.view Setframe:cgrectmake (40, 197, 240, 160)]; [Self.movieplayer Preparetoplay]; [Self.movieplayer Setshouldautoplay:no]; and other options can look through the documentation. [Self.view AddSubview:self.moviePlayer.view];
5. What to do after adding playback control
[[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (playbackfinished:) Name: Mpmovieplayerplaybackdidfinishnotification Object:movieplayer]; Playbackfinished'll be your own method.
Translated from:
http://stackoverflow.com/a/9802543/3458781
IOS plays local video files in the app