Re: [iOS] How to know when AVPlayer is ready to play its remote url music
Re: [iOS] How to know when AVPlayer is ready to play its remote url music
- Subject: Re: [iOS] How to know when AVPlayer is ready to play its remote url music
- From: Tharindu Madushanka <email@hidden>
- Date: Fri, 3 Dec 2010 17:20:02 +0530
Hi,
Got it finally working with Blocks. But I am not sure whether this is the
right way.. Is there any better way to determine playing started or not ??
// add time observer
// obs (id) defined in class header
obs = [[player addPeriodicTimeObserverForInterval:CMTimeMake(1, 3)
queue:NULL
usingBlock:^(CMTime time){
if
(player.currentItem.asset.duration.timescale == 0) {
NSLog(@"PLAY %f",
player.currentItem.asset.duration.timescale);
[player removeTimeObserver:obs];
} else {
NSLog(@"PREPARING %f %d",
player.currentItem.asset.duration.timescale, time.value);
}
}] retain];
Thanks,
Tharindu
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden