Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7927231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:12:17+00:00 2026-06-03T19:12:17+00:00

Apples documentation alludes to it, but how do you set up key-value observation for

  • 0

Apples documentation alludes to it, but how do you set up key-value observation for the loadedTimeRanges property of AVPlayerItem? That property is an NSArray that doesn’t change, so you can’t just use playerItem addObserver:self forKeyPath:@"loadedTimeRanges ...

Or is there another way to get notifications or updates whenever this changes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:12:18+00:00Added an answer on June 3, 2026 at 7:12 pm

    Actually, I’m using KVO for loadedTimeRanges without any trouble. Maybe you’re just not setting the right options? The following is a very slight modification of some of the code in Apple’s AVPlayerDemo, and it’s working quite nicely for me.

    //somewhere near the top of the file
    NSString * const kLoadedTimeRangesKey   = @"loadedTimeRanges";
    static void *AudioControllerBufferingObservationContext = &AudioControllerBufferingObservationContext;
    
    
    - (void)someFunction
    {  
        // ...
    
        //somewhere after somePlayerItem has been initialized
        [somePlayerItem addObserver:self
                           forKeyPath:kLoadedTimeRangesKey
                              options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew
                              context:AudioControllerBufferingObservationContext];
    
        // ...
    }
    
    - (void)observeValueForKeyPath:(NSString*) path 
                      ofObject:(id)object 
                        change:(NSDictionary*)change 
                       context:(void*)context
    {
        if (context == AudioControllerBufferingObservationContext)
        {
            NSLog(@"Buffering status: %@", [object loadedTimeRanges]);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apples documentation recommends to use pngs when loading images. But if you have a
Apple's documentation on UITableView discusses how to add/edit/delete rows, but it doesn't discuss adding/editing/deleting
I am trying to set up the configuration for Voldemort key-value store. Now, I'd
Apples documentation states that in general Quartz2D is thread-safe . However when drawing to
Maybe I'm missing something, but from Apple's documentation for NSHTTPCookieStorage , I can't help
When using NSXMLParser, what does NSXMLParserUndeclaredEntityError mean? Apples documentation is completely unhelpful
The Apple documentation says that the sender passed to the NSMenuItem's action can be
I have read the Apple documentation regarding Mobile Device Management (MDM) but did not
I've read all Apple documentation on the iPhone development and there's nothing that describes
Maybe I'm going insane, but I could have sworn that there was an PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.