1, the iOS video audio edge cache side play, the cache can be downloaded in the section to drag the progress bar. 3, whether the download to the half of the exit or download the exit, the cached data is saved to a path that you specify. If you have finished downloading, the next time you play, you can no longer go to the network and play local files directly. (see the actual effect of the 4.1 version after the video effect bar) to use several classes: 2, MPMoviePlayerController
Implementation steps: 2, open an HTTP server locally, spell a local address (http://127.0.0.1:xxxx/xxx.mp4), throw to MPMoviePlayerController play.
Just one thing to do: when Httpserver accepts a request to MPMoviePlayerController, the server first returns a request that contains the size of the entire video file. The MPMoviePlayerController then constantly requests the local server to fetch the data. My implementation is like this. When you want to be a video file, first open a request to download, when the total size of the file, save to a local dictionary, request continue to download, and then open LocalServer, spell a local URL to the player, Let him play it automatically. When LocalServer receives the request, it returns to the player the actual size of the file to be read locally according to the file being requested, and then the player can play. Httpserver himself has implemented the logic of the breakpoint download, you can set him a documentroot, the incoming file request will go directly to this directory to read the data of the file, His default implementation to get the total file size of the logic is to use Nsfilemanager directly to fetch the total size of the file, and here we need to save to the local dictionary read. That's about the idea, and don't want to write too much, because the actual code you write is really very small. Or to leave a train of thought, the real realization by everyone's own research, in short the realization is very simple, the final effect is very good, we all kinds of rest assured good. There are a few problems behind the novel. 2, MPMoviePlayerController is directly playable MP3, because we also need to play audio, and is the same page, if the full use of MPMoviePlayerController is the best, Because there is no need to switch the player, although it looks a bit clumsy. But later found that the problem is that when playing audio, some MP3 can not be dragged, when you change the audio playback time, MPMoviePlayerController directly stopped, but some audio is possible, the final study seems to be mp3 bitrate or format problems, Because we have a lot of MP3, and then replace the previous MP3 is not very realistic, the final implementation is the audio with Avplayer broadcast, buffering progress with MPMoviePlayerController, you can imagine how dirty the code is written. If people only do video or just start, it's better to study this question, and here I don't dig into it.
Open the local Server service locally on iOS, and then MPMoviePlayerController request the native local server service.
The native local server service then goes to the corresponding video address to get the video stream.
You can cache the video stream locally when you request it locally.
iOS development simple side-down playback for video audio (RPM)