iphone - Custom thumbnails for different types of multimedia -
i looking create thumbnails number of different document types (mp4, pdf, png, , ppt). have seen different methods doing them individually - mpmovieplayercontroller: requestthumbnailimagesattimes or uigraphicsgetcurrentcontext of current layer (effectively screen shot).
is there better way thumbnails of these files?
what preferred method of thumbnails of items? different method each?
as far i'm aware, there isn't generic way of doing this. i'd love proven wrong though.
i have same requirement in app i'm working on, , wrote thumbnail generator yesterday. approach took pass path file , completion handler block through thumbnail generator object.
the thumbnail generator has nsoperationqueue
spawns thumbnail generation process in background thread , returns placeholder thumbnail.
when thumbnail generated, thumbnail generator calls completion handler on main thread. you'll need use nsinvocation
object part.
doing synchronously results in noticeable delay if have more couple of thumbnails generate. using placeholder+completion handler block approach means ui remains responsive.
it's important call completion handler block on main thread because updating views, should ever done on main thread. if don't this, you'll strange errors, such scroll views not showing contents until scroll them.
you shouldn't need use mpmovieplayercontroller
thumbnails of videos though; avassetimagegenerator
"apple-approved" way of doing this; there's example of how in the av foundation programming guide.
Comments
Post a Comment