MPMoviePlayerController thumbnailImageAtTime:timeOption: simple case doesn't work

I build the movie player like this ...

    MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url];
    player.view.frame = myView.bounds;
    player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [player prepareToPlay];

    [myView addSubview:player.view];
    self.mp = player;

The url points to an m3u8 web stream. It plays just fine. Then I ask for an image like this ...

NSTimeInterval currentInterval = self.mp.currentPlaybackTime;
UIImage *image = [self.mp thumbnailImageAtTime:currentInterval timeOption:MPMovieTimeOptionExact];

I've tried backing the currentInterval up by one second. I've tried both time options (exact and keyframe), but image is always nil. Any idea why? Thanks.

Answers


My understanding is that the MPMoviePlayerController thumbnail methods don't work for HTTP Live Streaming (HLS) streams; only for files. Unfortunately I can't find an authoritative reference for that, although I saw, or read, it somewhere in the last couple of weeks. I've also had the same experience, myself.

That said, it might be possible to generate thumbnails for an HLS stream using AVAssetImageGenerator.

EDIT:

I've just tested AVAssetImageGenerator against a regular HTTP file, and the same file accessed over HLS. It was able to generate a thumbnail from the HTTP one, but the for the HLS one, AVAssetImageGenerator returned the following error:

NSLocalizedFailureReason=The operation is not supported for this media.

So, in summary, it looks as though HTTP Live Streaming doesn't support creating thumbnails. If your situation allows, you may be able to generate thumbnails on the server, make them available as a web service, then request them from the server in the client.


Need Your Help

Selenium2 with PhantomJS and PHPUnit - session/cookie issue

selenium cookies phpunit phantomjs session-cookies

I have setup my current project to run with Selenium and PhantomJS. (Similar setup to http://www.nuanced.it/2015/05/using-phantomjs-with-phpunit.html)

Click event on bar chart using c3js seems breaking on chrome

javascript google-chrome d3.js c3.js

I am trying to bind click event on bars' in bar chart. Its seems working fine in firefox, but breaking in latest chrome browser.