Question

OK. AvPlayer is working great with streaming audio. In my app I have UISlider that shows current seconds of the playing song. Now I'm trying to make audio seek with UISlider.

Here is the code

-(IBAction)slide{
Float64 curSec = mySlider.value;
int32_t tScale = 600;
CMTime mySec = CMTimeMakeWithSeconds(curSec, tScale); 
player.currentTime = mySec;     <- error is here

NSLog(@"%f",mySlider.value);
}

The error is "Setter method is needed to assign to object using property assignment syntax" In .h file I have AVPlayer *player; and @property(nonatomic, retain)AVPlayer *player. Also in .m I have @synthesize player; So what is wrong? THANK YOU!

Was it helpful?

Solution

According to the doc, it seems to me that you have to use seekToTime: method instead of setting time directly to the currentTime property.

OTHER TIPS

float second = 30.0;
CMTime time = CMTimeMake(second, 1);
[player seekToTime:time];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top