MonkeyMusic is a basic audio content provider app implementation that includes a simple Python-based media server.
In order to test the MonkeyMusic app, you must have a media server to host the audio content. We've included a sample server written in Python and some sample media for testing. Before attempting to run the server, install a Python 2.7 interpreter, which can be downloaded from the Python website at https://www.python.org/downloads/.
-
Open a Command Prompt/Terminal.
-
Check to make sure Python is in your path. An easy way to do this is to run
python -V
from the command line. If Python is properly installed, the Python version should be displayed:C:\Users\vitek>python -V Python 2.7.10
If you do not see a Python version number in the output, you will need to troubleshoot your installation. This typically involves modifying the
PATH
environment variable. -
Change directories to the MonkeyMusic project root folder, which contains the project
manifest.xml
file:C:\Users\vitek>cd C:\Projects\connectiq-apps\audio-provider\monkeymusic C:\Projects\connectiq-apps\audio-provider\monkeymusic>
-
Start the MonkeyMusic media server on port 8000:
C:\Projects\connectiq-apps\audio-provider\monkeymusic>python -m CGIHTTPServer Serving HTTP on 0.0.0.0 port 8000 ...
-
If you'd like to verify that the media server is working, you can visit http://localhost:8000/cgi-bin/media.py in a web browser, which should display a page with the following message:
There was an error in your request
Once the server is running, the client application can be used to obtain and play back content. An audio content provider app can run in one of four modes:
- Configure Sync
- Sync
- Configure Playback
- Playback
The steps below demonstrate each of the modes.
Note: This assumes that you have the Eclipse IDE installed and configured for Connect IQ development. See the Getting Started chapter of the Connect IQ Programmer's Guide for more information
- Open Eclipse and import the MonkeyMusic project.
- Create a Run Configuration for the MonkeyMusic project using the Forerunner 645M device.
- Run the sample in the Connect IQ simulator.
- Disable Settings > Use Device HTTPS Requirements, so that the simulated device can connect to the server over HTTPS.
NOTE: This will not cause a security issue while you are connecting locally in the simulator. When you deploy your app however, any endpoints you connect to should be secured with HTTPS.
- Choose Settings > Media Mode > Sync Configuration from the simulator top menu.
- Select one or more tracks from the displayed list of downloadable tracks.
- Select Done from the menu, and the app will exit.
- Run the sample in the simulator again.
- Choose Settings > Media Mode > Sync from the simulator top menu. A progress bar will appear while the download is in progress.
- When completed, press or swipe Back, and the app will exit.
- Run the sample in the simulator again.
- Choose Settings > Media Mode > Playback Configuration from the simulator top menu, and a list of downloaded tracks will appear.
- Select one or more tracks from the displayed list of downloaded tracks.
- Select Done from the menu, and the app will exit.
- Run the sample in the simulator again.
- Select Playback from the simulator top menu to display standard playback controls and current track information. Device inputs (buttons, touch screen, etc., depending on the devcie) can be used to control the selected track. No actual playback occurs.