The audio player

Our next step in this project is to build the user interface for controlling the audio. Add a new file called AudioPlayerPage.cs inside the Views folder; don't forget to add the attribute above the class declaration to register the view-model for the MVVMCross framework:

[MvxViewFor(typeof(AudioPlayerPageViewModel))] 
public class AudioPlayerPage : MvxViewController 
{ 
   private UIButton playButton; 
 
        private UISlider _progressSlider; 
 
        private bool _playing; 
 
        private AudioPlayerPageViewModel _model; 
} 

Note

We have declared some local scope variables that need to be used across multiple functions; you will see how these will be used later.

Now let's create the UI elements via the ViewDidLoad function:

public override void ViewDidLoad() { base.ViewDidLoad(); ...

Get Xamarin Blueprints 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.