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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:36:10+00:00 2026-06-16T15:36:10+00:00

I am trying to play Media Item that selected from UITableView in iOS. I

  • 0

I am trying to play Media Item that selected from UITableView in iOS.

I am using MediaQuery and i loaded songs list from iPod Library in my UITableView.

But i don’t know how to play that selected songs from UITableView.

I know really basic simple AudioPlayer with following code.

NSString *soundFilePath = [[NSBundle mainBundle] pathForResource: @"sample" 
                                                              ofType: @"mp3"];
    NSURL *fileURL = [[[NSURL alloc] initFileURLWithPath: soundFilePath] autorelease];
    self.player = [[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error: nil] 
                   autorelease];

That is used of ContentOfURL that already located in resource.There is no need to retrieve songs from iPod Library.

Here is my CellForRowAtIndexPath Method Codes

MPMediaItemCollection *songs = [self.arrayOfSongs objectAtIndex:indexPath.row];

    cell.textLabel.text = [songs.items[0] valueForProperty:MPMediaItemPropertyTitle];

Now i am trying to play that retrieved songs from iPod Library with MediaQuery and that selected from UITableView

So How can i retrieve the URL and play the song from iPod Library that selected from UITableView?
Thanks for your reading.

  • 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-16T15:36:12+00:00Added an answer on June 16, 2026 at 3:36 pm

    You need to implement your didSelectRowAtIndexPath like the following code:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
       MPMediaItemCollection *songs = [self.arrayOfSongs objectAtIndex:indexPath.row];
       MPMediaItem *item = [songs representativeItem];
       self.player = [[[AVAudioPlayer alloc] initWithContentsOfURL:[item valueForProperty:MPMediaItemPropertyAssetURL] error: nil] 
                       autorelease];
    
    }
    
    • 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 the selected media from PlayList,if the selected index is
I'm trying to play songs from an iPod playlist. As far as playlist may
I've heard that Windows Media Player has problems trying to play H.264 video over
I am trying to play a song from my iPhone music library using AVPlayer.
I am trying to play video files from iPhone media player in my iphone
While trying to play video using media player, I am getting this error: Unable
I am trying to play a ringtone which is selected from a RingtonePreference. How
I am trying to play an mp3 using the Media player class. When I
I have been trying to play a video that was converted using http://www.mirovideoconverter.com/ to
I am trying to play url using media player in activity using: mediaPlayer =

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.