Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

This is a sample UIKit (iOS) application that allows a user to play audio files using AudioKit.

Notifications You must be signed in to change notification settings

cpisciotta/Audio-Player-Example

Repository files navigation

Audio Player Example

© 2021 Charles Pisciotta

A sample UIKit (iOS) app that allows a user to simply play locally stored audio files using AudioKit.


This project was put together for my interview with SoundMind before joining as an iOS Developer. The initial project requirements, some basic files, assets, and project skeleton were written and/or provided by SoundMind (Jack Zimmer and Jason Silberman). On receiving the project, I implemented all of the necessary files (i.e. audio playback, navigation, asset management, etc.), restructured the project, and added assets (i.e. the app icon and cover images for sounds).


This sample app displays a list of audio files that are stored locally. The home screen is a simple UITableViewController that lists the audio files as SoundTableViewCells. Each cell contains the name of the audio file and a PlayingIndicator. The latter is highlighted when currently playing and, at any given time, only one indicator can be highlighted as only one file can play at once. At the start, no audio plays, so all indicators start unhighlighted and all remain unhighlighted when no audio is playing.

On click of a SoundTableViewCell, a PlayerViewController is displayed modally. The PlayerViewController consists of the following UI elements: a background image consistent with the audio file, a large title at the top displaying the name of the audio file, and a button at the bottom allowing the user to play and pause the sound. When that specific audio file is playing, the button shows a pause icon; when that specific audio file is not playing, the button shows a play icon. Note, if an audio file is playing, only the modal view controller of that audio file will toggle the default button icon.


Launch Screen Home Screen with No Music Playing Home Screen with Music Playing Home Screen with Music Playing in Dark Mode Audio File Player Screen with No Music Playing Audio File Player Screen with Music Playing


Features

  • View locally stored audio files in a table view and determine which, if any, file is currently playing via the PlayingIndicator.
  • Play and pause audio files on click of a table view cell via a modally displayed PlayerViewController.

Known Bug

On startup and when playing audio, the following errors print to the console:

AddInstanceForFactory: No factory registered for id
AURemoteIO.h:323:entry: Unable to join I/O thread to workgroup ((null)): 2

This error was reported issue on GitHub and can be found here. It appears that this issue relates to using the simulator and might be unavoidable.


Development Process

Understanding

  1. Read the instructions to understand the scope of the problem, the features that need to be implemented, and any development constraints.
  2. Review the prewritten code to understand the structure of the codebase, the assets included, the technologies used, and the features that need to be implemented.
  3. Read the documentation for AudioKit to understand the basic use of the framework.

Design Preparation

  1. Create a basic sketch of what the sample detail view will look like when completed.

Development

  1. Create a model to hold the Audio File data. This includes the name of the file, the name of the image, and any other metadata.
  2. Develop the SoundTableViewCell to display a preview of the audio files.
  3. Develop the PlayerViewController to display a detailed view of the audio file, including its cover image, and to allow play/pause functionality.
  4. Complete the play and pause functions in CPAudioPlayer to allow for proper audio playback using AudioKit. This includes enabling playing in the background.

Testing

  1. Develop now, and throughout the process, unit tests to ensure that the code is functioning properly. In this case, unit tests were set up to ensure that each audio file was successfully played and paused.
  2. Use the app and determine any remaining issues, bugs, or improvements.

Documentation and Clean Up

  1. Write now, and throughout the process, documentation to help for readability and understanding.
  2. Ensure that all existing code is written cleanly and efficiently.

Final Deliverable

  1. Send the finished prototype for review.

Requirements

  • iOS 14.0+
  • Xcode 12.0+

Using the application

Download or clone the project to Xcode. Run the code on the simulator or a physical device.


Meta

Charles Pisciotta – Freelance iOS Developer – cpisciottadeveloping@gmail.com

https://github.com/cpisciotta

About

This is a sample UIKit (iOS) application that allows a user to play audio files using AudioKit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages