Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping AVPlayer on iOS

I am using AVPlayer to play a live stream from the Internet. AVPlayer can be paused, but on resume it starts off from the moment it was paused, just like a TiVO. AVPlayer does not have a stop method.

How does one make it continue with what is currently being broadcast (as though you turned your car radio off and back on)?

like image 402
BergQuester Avatar asked Dec 16 '10 03:12

BergQuester


2 Answers

-(void)seekToTime:(CMTime)time

use this method to get to beginning of file

like image 78
Tejesh Alimilli Avatar answered Sep 18 '22 23:09

Tejesh Alimilli


To stop an AVPlayer:

[player replaceCurrentItemWithPlayerItem:nil];

That will free up all the memory and processor resources it and its associated asset consumed. Simple as that.

like image 38
James Bush Avatar answered Sep 17 '22 23:09

James Bush