Implementing MusicPlayer

MusicService invokes appropriate media player actions by calling media functions implemented in MusicPlayer. MusicPlayer will also contain a reference to MusicService so that it can notify MusicService if the media player's state changes.

Here are the steps to create MusicPlayer.

  1. Open Visual Studio 2017.
  2. Go to File | Open | Project/Solution, go to your MyPodCast directory, and choose the MyPodCast.sln file.
  3. Right-click on the MediaService folder | Add | New Item | select Visual C# Class and name the file MusicPlayer.cs.
  4. Click Add.
  5. Open MusicPlayer.cs by double-clicking the file.
  6. Create a public class, MusicPlayer, which implements AudioManager.IOnAudioFocusChangeListener, MediaPlayer.IOnCompletionListener, MediaPlayer.IOnErrorListener ...

Get Voice User Interface Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.