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

  • Home
  • SEARCH
  • 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 6379625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:09:45+00:00 2026-05-25T02:09:45+00:00

I want to reconnect to the server when the streaming buffer is empty. How

  • 0

I want to reconnect to the server when the streaming buffer is empty.

How can I trigger a method when the AVPlayer or AVPlayerItem buffer is empty?

I know there are playbackLikelyToKeepUp, playbackBufferEmpty and playbackBufferFull methods to check the buffer status, but those are not callbacks.

Are there any callback functions, or any observers I should add?

  • 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-05-25T02:09:46+00:00Added an answer on May 25, 2026 at 2:09 am

    you can add observer for those keys:

    [playerItem addObserver:self forKeyPath:@"playbackBufferEmpty" options:NSKeyValueObservingOptionNew context:nil];
    [playerItem addObserver:self forKeyPath:@"playbackLikelyToKeepUp" options:NSKeyValueObservingOptionNew context:nil];
    

    The first one will warn you when your buffer is empty and the second when your buffer is good to go again.

    Then to handle the key change you can use this code:

    - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
                            change:(NSDictionary *)change context:(void *)context {
        if (!player)
        {
            return;
        }
    
        else if (object == playerItem && [keyPath isEqualToString:@"playbackBufferEmpty"])
        {
            if (playerItem.playbackBufferEmpty) {
                //Your code here
            }
        }
    
        else if (object == playerItem && [keyPath isEqualToString:@"playbackLikelyToKeepUp"])
        {
            if (playerItem.playbackLikelyToKeepUp)
            {
                //Your code here
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Want to know what the stackoverflow community feels about the various free and non-free
want to know why String behaves like value type while using ==. String s1
want to have a Hyperlink-Button in a gridView in which I can display a
want to ask user to input something but not want to wait forever. There
I want to download a huge file from an ftp server in chunks of
How long can I expect a client/server TCP connection to last in the wild?
Want my FireFox at work to be in sync with my FireFox at my
Want the function to sort the table by HP but if duplicate HPs then
Want to be able to provide a search interface for a collection of objects
Want to code a key pad for an calculator. What I want to make

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.