Video playback, in fact, no difficulty, I now understand, a controller, with a view. Where controller is responsible for loading video Url,controller generally have the following functions: Play (play), Stop (pause), Nextone (next), Beforeone (previous), Popview (back) While view is responsible for placing the URL's video frame on the view display, it can be imagined that a second display replaces many images, which constitutes a video playback.
For example, integrated third-party poly video.
Instantiate the video player while loading the video URL
Self. Plvideoplayer = [[Plvmovieplayercontroller alloc]initwithvid:[nsstring stringwithformat:@ "%@", _movieURL]];
Put the video player's view on the Self.view to show the video, otherwise you won't see the video effect. (Just like the movie theater does not put the film screen on the wall, can't see the movie playing)
[Self.view addsubview:self. Plvideoplayer.view];
Set self. Plvideoplayer.view size, if one comes in horizontal screen playback, Self.PLvideoPlayer.view is also the default is horizontal screen playback, then you have to adjust the size of the view, the width of the view is the screen is high, the height of the view is the screen width.
[Self. Plvideoplayer.view Setframe:cgrectmake (0,0,[uiscreen mainscreen].bounds.size.height,[uiscreen MainScreen]. Bounds.size.width)];
The last one is play. Play the video animation.
[Self. Plvideoplayer Play];
By the way, with a mouth barrage video of the approximate idea, the barrage is a textview, in self. Plvideoplayer.view from the right to the left, on the view of the curtain can be arbitrarily added to the view, can also be animated, this is not difficult to understand. The client and serve establish a long connection, the user sends a comment, the post to the Serve,serve side push to the client side a comment, TextView contains the comment string, across the screen. The effect of simple projectile screen is realized. Sliding path customization, each font size color custom, or a background comment string, with the attribute parameters come over (let the background to deal with the style problem, the front end will not need to process).
ios-Video Playback