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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:20:00+00:00 2026-05-14T00:20:00+00:00

iam using AVFoundation Framework to play mp3 file ,everything works great ، i have

  • 0

iam using AVFoundation Framework to play mp3 file ,everything works great ، i have 2 buttons and i put they together , [Play and resume with .hidden function],when user play music [play button going to hide and resume button un hide], so if the user change view , (music is playing) and back to previews view, the buttons don’t work normally it means just play music and resume doesn’t work , i put my codes to the viewDidLoad , and i know it’s because of that but how can i solve this problem ?

   NSString * musicSonati = [[NSBundle mainBundle] pathForResource:@"music"      ofType:@"mp3"];
myMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:musicSonati] error:NULL];
myMusic.delegate = self;
myMusic.numberOfLoops = -1; 
pauseM.hidden = YES;
play.hidden = NO;
  • 1 1 Answer
  • 1 View
  • 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-14T00:20:00+00:00Added an answer on May 14, 2026 at 12:20 am

    My guess is that a big part of your problem is that your “previews view” is handling all the responsibility for playing the sounds through the AVAudioPlayer framework. What you want to do instead is redesign your app, so there is a proxy object handling AVAudioPlayer. Create and initalize this proxy object in your app delegate, and then pass it along to the root view controller, and through to any other view controllers that need to handle sound playing.

    With that redesigned, your “previews view” merely has to ask (in viewDidLoad) your sound proxy object if it’s playing a sound (whether by interrogation, or by registering to receive NSNotifications from the object) and set its own state (i.e. buttons) accordingly.

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

Sidebar

Related Questions

Iam using the following code in my file for overlay image.This works fine in
Iam using flowplayer to embed an flv file in a page. It works just
I am using the AVFoundation framework to play a sound. At the beginning of
I am reading a video file using AVFoundation framework and getting the image buffers
I am using AVFoundation framework in my iPad app to record videos.When recording of
I am trying to implement video capture in my app using AVFoundation. I have
Iam using structure map for resolving my dependencies, however i have a rather special
Iam using netbeans 6.9 for PHP , the file i was working on corrupted
Iam using c# vs2010. For my windows forms project I have some PNG,Gif,Jpg images
iam using dompdf to generate pdf file from html , the problem is the

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.