I use AVAssetImageGenerator
to get thumbnail image on AVPlayerDemo
, for HLS stream, it works fine on iOS8 and iOS9, but fails on iOS10. The HLS stream is the one which has "I-Frame only playlist", for example stream “https://tungsten.aaplimg.com/VOD/bipbop_adv_example_v2/master.m3u8”. Other streams which have no "I-Frame only playlist" is out of the scope of discussion.
From Apple official guide it doesn't mention that AVAssetImageGenerator
doesn't support HLS, but it only mention that requestThumbnailImagesAtTimes(for MPMoviePlayer)
doesn't support HLS stream. Now it works fine on iOS8 but fails on iOS10, it makes me feel confused and uncomfortable since we want to deliver this functionality to our clients but it is blocked on iOS10.
I searched lots on internet and stackOver then I know that for AVAssetImageGenerator
, it do not support HLS stream(Both HLS-VOD and HLS-Live). The reason I guess as following:
(1)From my observation, HLS stream has no asset.tracks(it is the precondition for thumbnail image generation), it has only currentItem.tracks.
(2)From point (1), I guess that since "asset" is the input parameter of AVAssetImageGenerator initialisation function([[AVAssetImageGenerator alloc] initWithAsset:myAsset])
, and for HLS stream, asset.tracks is empty, so AVAssetImageGenerator could not generate any thumbnail for HLS stream. Although currentItem.tracks exist but they dont' work at this situation.
But my question is that, if AVPlayer do not support generate "Asset Image" for HLS stream, why it works fine on iOS8 and iOS9, and then why fails on iOS10? Does any one has the same experience with me, and how about your understanding? Or is there anyone success on iOS10?
And I don't prefer to use copyPixelBufferForItemTime
(I met many answers about it^_^), since I expect that when user slides the slider bar to preview the thumbnail image, the playing should be continue without pause or seeking.
Could you please help to give some lights on that?