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