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 8678197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:39:16+00:00 2026-06-12T20:39:16+00:00

I am using AVPlayer to play sound from different sources (including iPod music library).

  • 0

I am using AVPlayer to play sound from different sources (including iPod music library). Due to the fact that AVPlayer is more low level AVAudioPlayer I have to handle interruptions myself. Using AVAudioPlayer is not an option!

In the Apple developer documents they mention to either listen AVAudioSessionInterruptionNotificationor setup a listener with AudioSessionInitialize. But when doing so I only receive notifications when the interruption ended, but due to their documents my app should be able to handle both.

I am using the following code to initialize my audio session: (simplified version, removed unimportant lines)

AudioSessionInitialize(NULL, NULL, ARInterruptionListenerCallback, nil);
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);
AudioSessionSetActive(true);

And here is how the listener looks like:

void ARInterruptionListenerCallback(void *inUserData, UInt32 interruptionState) {
    if (interruptionState == kAudioSessionBeginInterruption) {
        // Here is the code which is never called...
    }
    else if (interruptionState == kAudioSessionEndInterruption) {
        // But this case will be executed!
    }
}

Btw. I am expecting this code executed when there is an interruption like a phone call or similar. Am I misunderstand what Apple declares as interruption?

  • 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-12T20:39:17+00:00Added an answer on June 12, 2026 at 8:39 pm

    There is a bug in iOS 6. The interrupt code never seems to be called for begin interrupt – That includes both the old deprecated method (using AVAudioSession delegate) and the new notification method.

    Myself and a few others have raised a high severity bug request with Apple so I suggest you do the same (bugreport.apple.com) to get their attention.

    I’m not sure what you’re using the interrupt for, but I was using it to allow audio to resume after the interrupt if necessary, and also update the play/pause button in the interface. I had to change my method to watch the AVPlayer rate property to toggle the play/pause button, and not allow audio to resume after an interruption.

    Edit: see this thread

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to play a song from my iPhone music library using AVPlayer.
I am able to play songs from iPod library using AVPlayer class. Now what
i want to select songs from ipod Library and play it using avplayer i
I am using AVPlayer for playing song from iPod Library. There are very limited
I'm using AVPlayer to play live audio streamed from the Internet, but when it's
I know it is possible to play iPod Songs using AVPlayer, but I cannot
I am developing a DRM video player using AVPlayer and AVPlayerItem that can play
My application is using AVPlayer to play video. There is a serious problem that
I am using AVPlayer to play a live stream from the Internet using the
I'm trying to play an mp3 (camera shutter sound) using AVPlayer. I've stripped everything

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.