Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HLS AVPlayer on iOS - return to live

I have an AVPlayer which is streaming a live HLS stream.

When the user multitasks the app, I see the play rate drop to 0.0 (paused), when the user comes back it return to 1.0(play), but starts playing from the point it was paused.

What is the best way to force the player back to live without restarting the stream completely? Is there a seekToTime method that handles a closest to live time parameter?

Thanks!

like image 459
angelfilm entertainment Avatar asked Oct 30 '12 18:10

angelfilm entertainment


1 Answers

I use:

 double time = MAXFLOAT;
 [player seekToTime: CMTimeMakeWithSeconds(time, NSEC_PER_SEC)];

Works well in my app.

like image 161
Igor Kulagin Avatar answered Oct 19 '22 17:10

Igor Kulagin