• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iOS] How to know when AVPlayer is ready to play its remote url music
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >[iOS] How to know when AVPlayer is ready to play its remote url music (From: Tharindu Madushanka <email@hidden>)

  • Prev by Date: [iOS] How to know when AVPlayer is ready to play its remote url music
  • Next by Date: Re: Using MAPM with Cocoa/ObjectiveC
  • Previous by thread: [iOS] How to know when AVPlayer is ready to play its remote url music
  • Next by thread: QT streaming with initWithAttributes
  • Index(es):
    • Date
    • Thread