ios - Streaming Technique from pocketcast in xcode -
i've been asked client whether possible download video , stream once bit has downloaded, pocketcasts does. reasoning allow him store video files on site such godaddy , bypass need stream file phone requires dedicated server.
is possible? if know anywhere can find out how pocketcasts it? @ moment app streams mp4.
thanks looking,
matt
since you're targetting ios, hls (http live streaming) friend: https://developer.apple.com/streaming/
please see answer here how can use it: simultaneously downloading , playing song pieced multiple urls
it's easy run long movie through mediafilesegmenter tool apple (or ffmpeg) spits out number of small .ts files (mpeg 2 transport stream). create manifest (a .m3u8 file) describes how these files fit (which mediafilesegment create too!). put manifest file , .ts files on hosting provider (like godaddy) , you're set.
for example, given file called test.mp4, first turn .ts file ffmpeg:
ffmpeg -i test.mp4 -acodec copy -vcodec copy -bsf h264_mp4toannexb test.ts then turn series of hls segments mediafilesegmenter (the same can done using ffmpeg segment muxer, mediafilesegmenter seems more robust):
mediafilesegmenter -t 3 test.ts the result bunch of 3 second clips (that's -t 3 means) , manifest file called prog_index.m3u8. contents of like:
#extm3u #ext-x-targetduration:3 #ext-x-version:3 #ext-x-media-sequence:0 #ext-x-playlist-type:vod #extinf:2.99520, filesequence0.ts #extinf:2.99520, filesequence1.ts #extinf:2.99520, filesequence2.ts #extinf:2.99520, filesequence3.ts ... #extinf:0.37440, filesequence75.ts #ext-x-endlist simply putting of .ts files , .m3u8 file on web server , pointing avplayer or mpmovieplayercontroller in ios @ url .m3u8 excellent streaming performance.
Comments
Post a Comment